Geocialize your software!
Add Hoccer-like connectivity to your app in minutes!
Use our open Linccer Connection API to link devices at hand and give your users the ability to simply connect devices, join for a game or to collaborate off the cuff.
Example Code
var linncer = Linccer({"api_key": "your_api_key", "server": "sandbox" });
window.onload = function() {
if (!Linccer.autoLocate()) {
linccer.setEnvironmentCoordinates(longitude, latitude, accuracy);
}
linccer.on('received', function(data) {
// do somthing with the received data
});
// receive data from a distribution
linccer.receive('ont-to-many');
// distribute data
linccer.send('one-to-many', {arbitrary : 'json data'});
}
Linccer linccer = new Linccer(new ClientDescription("Demo App"));
// publish a gps position (lat, long, accuracy)
linccer.onGpsChanged(23.44, 102.13, 100);
// safely pass data to an other client here and now
linccer.share("one-to-one", new JSONObject("{ 'demo' : 'arbitrary json' }"));
// safely receive passed data from an other client here and now
JSONObject payload = linccer.receive("one-to-one");
- (void)viewDidLoad {
linccer = [[HCLinccer alloc] initWithApiKey: @"1234567890"
secret: @"secret!!!11elf"];
linccer.delegate = self;
}
- (IBAction)send: (id)sender {
NSDictionary *payload = [NSDictionary dictionaryWithObject: @"World"
forKey: @"Hello"];
[linccer send: payload withMode: HCTransferModeOneToOne];
}
- (IBAction)receive: (id)sender {
[linccer receiveWithMode: HCTransferModeOneToOne];
}
#pragme mark -
#pragma mark HCLinccer Delegate Methods
- (void)linccerDidRegister: (HCLinccer *)aLinccer {
NSLog(@"ready for transfering data");
}
- (void)linccer: (HCLinccer *)aLinccer didSendDataWithInfo: (NSDictionary *)info {
NSLog(@"successfully send something %@", info);
}
- (void)linccer: (HCLinccer *)aLinccer didReceiveData: (NSArray *)data {
NSLog(@"received data: %@", data)
}
# Create new LinccerClient instance
client = LinccerClient.new
# Update client environment
client.update_environment(
:gps => {:longitude => 12.2, :latitude => 14.2, :accuracy => 23.0}
)
# Share data
# The share method expects a mode and an arbitrary ruby hash which will
# be transformed to JSON and used as the payload.
c.share( "one-to-one", :foo => "bar" )
# Receive data
# The receive method expects a mode parameter and returns a ruby hash
# containing the payload
c.receive( "one-to-one" )
AsyncLinccer linccer =
new AsyncLinccer(new ClientDescription("Demo Android App"));
// publish a gps position obtained from Android's LocationListener
linccer.onGpsChanged(location);
// publish a wifi data obtained from Android's WifiManager
wifiManager = (WifiManager) pContext.getSystemService(Context.WIFI_SERVICE);
linccer.onWifiScanResults(wifiManager.getScanResults());
// creating and Android event handler to give user feedback
Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
String toast = "transfer failed";
if (msg.what == AsyncLinccer.MessageType.SHARED)
toastMessage = "sharing faild";
else if (msg.what == AsyncLinccer.MessageType.RECEIVED)
toastMessage = "received " + (JSONObject) msg.obj;
Toast.makeText(this, toastMessage, Toast.LENGTH_LONG).show();
}
};
// safely pass data to an other client here and now
linccer.asyncShare("one-to-one",
new JSONObject("{ 'demo' : 'arbitrary json' }"),
handler);
// safely receive passed data from an other client here and now
linccer.asyncReceive("one-to-one", handler);
Linccer linccer = new Linccer ();
linccer.Config = new ClientConfig ("C# Demo");
// publish a gps position
linccer.Gps = new LocationInfo { Latitude = 52.5157,
Longitude = 13.409,
Accuracy = 1000 };
linccer.SubmitEnvironment ();
// pass data to an other client here and now
MyDataClass data = new MyDataClass(...);
linccer.share("one-to-one", data);
// receive passed data from an other client here and now
MyDataClass receivedData = linccer.receive<MyDataClass>("one-to-one");
Read the API Documentation.
Getting started
- Choose README file for your specified API: JavaScript, Java, Ruby, Android or C#/.Net and check the genaral API Documentation
- Try the examples
- Sign up for your API Key
- Implement world shattering Apps
- Get involved to improve the APIs and make suggestions
Our iOS API is currently under development and will be re-published soon
