Friday, April 22, 2011

Publishing FaceBook Checkin a place in Android


Step 1: In-order to publish a place via checkin we are in need of the following parameters

1. Access Token
2. Place which is to be Checkin
3. Message which will display to your friends
4. Latitude and Longitude of that place
5. Tag i.e. User Id

Step 2: Use Bundle to wrap the above parameters

Bundle params = new Bundle();
params.putString("access_token", Main.access);
params.putString("place", "203682879660695");
params.putString("Message","I m here in this place");
JSONObject coordinates = new JSONObject();
coordinates.put("latitude", Main.mylat);
coordinates.put("longitude", Main.mylong);
params.putString("coordinates",coordinates.toString());
JSONArray frnd_data=new JSONArray();
params.putString("tags", "xxxx");//where xx indicates the User Id

Step 3:  Call the Request method and check whether proper response you had got

String response = faceBook.request("me/checkins", params, "POST");
Log.d("Response",response);

1 comment:

  1. Thanks Sankar..Really this snippet helped me a lot.
    Keep posting.

    ReplyDelete

Notification in Android Using AlarmManager, BoradCastReceiver & Services

    Our aim is to show notification message to user in a specific time.     Say For example , I have planned to show Notification ...