简体   繁体   中英

Android Facebook check in with new 3.0 Facebook SDK

I could check in with the older Facebook SDK used this code:

Facebook fb = new Facebook("APP ID");

Bundle params = new Bundle();
params.putString("access_token", "TOKEN");
params.putString("place", "PLACE ID");
params.putString("message","SOMETHING MESSAGE");

JSONObject coordinates = new JSONObject();
coordinates.put("latitude", "LATITUDE");
coordinates.put("longitude", "LONGITUDE");

params.putString("coordinates",coordinates.toString());
params.putString("tags", "USER ID");

String response = fb.request("me/checkins", params, "POST");

But the fb = new Facebook() and the fb.request() functions are deprecated in new 3.0 Facebook SDK! What can I replace them with? How can I check in with using the 3.0 Facebook SDK?

The Graph API need "publish_checkins" extended permission in Facebook app, but this permission is deprecated also.

You should use the static methods of the Request class to create requests and execute them. Looks like the most suitable method would be newStatusUpdateRequest that takes a GraphPlace as a parameter.

Alternatively, you can use the newPostRequest which allows you to construct a request that is much more similar to the way it was in previous SDK.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM