[問題] 關於利用FACEBOOK的UI打卡

看板AndroidDev作者 (安安啦)時間12年前 (2013/09/18 02:27), 編輯推噓0(003)
留言3則, 3人參與, 最新討論串1/1
小弟目前研究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
建議你直接去看 facebook API的文件
09/19 01:15, 1F

09/23 19:40, , 2F
可是我都找不到checkins那部分 不過還是謝謝你
09/23 19:40, 2F

09/25 13:19, , 3F
那就另外用個fuction去促發打卡這件事情,一起執行
09/25 13:19, 3F
文章代碼(AID): #1IE9y3za (AndroidDev)