[問題] 關於利用FACEBOOK的UI打卡
小弟目前研究FB的打卡功能
有爬到利用DIALOG發文至塗鴉牆
但是沒有找到利用DIALOG打卡
只能給定PlacID直接打卡
小弟的目標是達到利用DIALOG打卡 可以在打卡的時候順便發動態
參考的是這位黃承達老師
http://ppt.cc/V24m
這是網址
以下是程式碼
-------------------------------------------------------
private void checkinUsePlaceId() {
Session session = Session.getActiveSession();
if (session != null){
// Check for publish permissions
List<String> permissions = session.getPermissions();
if (!isSubsetOf(PERMISSIONS2, permissions)) {
pendingPublishReauthorization = true;
Session.NewPermissionsRequest newPermissionsRequest = new Session
.NewPermissionsRequest(this, PERMISSIONS2);
session.requestNewPublishPermissions(newPermissionsRequest);
return;
}
Bundle postParams = new Bundle();
postParams.putString("message", "Facebook SDK for Android");
postParams.putString("place", "143732889106296");
Request.Callback callback= new Request.Callback() {
public void onCompleted(Response response) {
JSONObject graphResponse = response
.getGraphObject()
.getInnerJSONObject();
String postId = null;
try {
postId = graphResponse.getString("id");
} catch (JSONException e) {
}
FacebookRequestError error = response.getError();
if (error != null) {
Toast.makeText(MainActivity.this
.getApplicationContext(),
error.getErrorMessage(),
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(MainActivity.this
.getApplicationContext(),
postId,
Toast.LENGTH_LONG).show();
}
}
};
Request request = new Request(session, "me/feed", postParams,
HttpMethod.POST, callback);
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
}
}
private boolean isSubsetOf(Collection<String> subset, Collection<String>
superset) {
for (String string : subset) {
if (!superset.contains(string)) {
return false;
}
}
return true;
}
----------------------------------------
謝謝各位
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.134.102.223
→
09/19 01:15, , 1F
09/19 01:15, 1F
→
09/23 19:40, , 2F
09/23 19:40, 2F
→
09/25 13:19, , 3F
09/25 13:19, 3F