In order to access the LocalSocial cloud service you must first register as a developer. The developer web-site
allows you to create new applications and view data related to your current applications (for example you can
view the number of downloads or view graphs of various analytical data for your applications)
The developer registration link is here.
As a developer, you can register a new application. To register an application you need to supply 2 pieces
of information, an application name (for example, Dowser) and namespace (this value must be unique
, for simplicity you should probably use something like the package nmae of your demo, for example dowser uses
Once the application has been registered, you can view the
application details. When you come to implement your first application you will need to supply the Consumer Key/ Secret
and the application name to the LocalSocial Library.
The application registration link is here.
How to use the APIs
Once you have registered a new application (and have noted your Consumer Key/Secret), you can now start using
the Java Android library.
In order to authorise an instance of an application running a on a device, a developer must provide some initial
data to configure LocalSocial. This data is available on the developer application details page.
The following code creates an instance of com.localsocial.config.SimpleAppConfiguration.
It sets :
Once the configuration has been created, we then call com.localsocial.LocalSocialFactory.setDefaultConfig,
to configure the default LocalSocial instance.
Once the LocalSocialFactory class has been properly configured then we can use
LocalSocialFactory.getLocalSocial() to get the default LocalSocial instance. This
LocalSocial instance is then used to create an AccessToken. The following code sample illustrates this authorisation
LocalSocial exposes its proximity information through the com.localsocial.Neighbourhood.
Once you have created a LocalSocial and authorised it, you can then get an instance of the Neighbourhood.
In order to discover the devices that are in your vicinity, you need to register a neighbourhood observer.
Once registered, LocalSocial will inform your observer when a proximity event occurs (assuming you are
scanning the neighbourhood).
The following code sample shows how to register a
com.localsocial.proximity.observers.NeighbourhoodObserver that logs whenever a device
comes into range.
An instance of com.localsocial.remote.TagRemote is required to access the
LocalSocial Tag API.
For example, the following code illustrates how to get a TagRemote Object instance.
CRUD stands for Create, Read, Update and Delete..
The following code samples show how to implement the Tag CRUD methods.
Create a Tag
Use the following code to create a Tag on the current device.
Read a Tag
Use the following code to read a Tag set on the current device.
Update a Tag
Use the following code to update a Tag set on the current device.
Delete a Tag
Use the following code to delete a Tag.
Tagging Discovered Devices
The previous samples all illustrate how to tag the current device. Tagging a discovered device is only more difficult
in that it should be performed in a threaded environment (you can call any of the TagRemote methods directly but
since these methods involve remote calls you should do them in a separate thread).
The following code shows how to tag discovered devices with a timestamp that shows when they were last seen by
The javadocs for the LocalSocial library are available here, you should probably
read them before creating your first application. (Please note that these APIs are subject to change).
As already noted the latest version of the LocalSocial jar for android is available
The current android dependencies are :
- scribe : Simple OAuth library for Java.
We are currently working on the latest version of J2ME library.