Medium_icon

Local Tweets

This tutorial app demonstrates possibilities of integration of your proximity-oriented mobile application with a social network, on example of Twitter. Local Tweets app performs a constant bluetooth scan and lists all discovered devices nearby. You can select a device from the list, and if it has an associated Twitter account, the application will open its Twitter stream in a web view.

Download the Source Code

This source code shows you how to get started using LocalSocial and walks you through the very initial elements you need to use in the LocalSocial Library on Android, and in the LocalSocial API.

Download Source

Network Auth

The Main UI activity of the application extends Android ListActivity and lists devices that are in range.

After LocalSocial is successfully configured and authorised (these steps are described earlier), the application checks if a device it runs on has a Twitter account associated with it by pulling remote Tulsi tags:

If it is not the first run of the application and Twitter have been successfully authorised previously, the appropriate network tag is retrieved. Otherwise, null value is returned, and Twitter authentication procedure gets started, which triggers LocalSocial's NetworkAuthActivity.

LocalSocial does network authorisation for you, so you don't have to register your application with a network provider. However API calls are not supported yet - for now you can only get a stream from a network. This is a subject of current work, so better network support will be available soon.

The following snippet of code demonstrates how a network stream is loaded. A WebView is used to display a web page.