2
A
回答
3
这是我如何得到使用Facebook SDK为Android通知。下面的代码获取登录/认证的用户通知。
//Initialze your Facebook object, etc.
Facebook _facebook = ...
...
Bundle bundle = new Bundle();
bundle.putString(Facebook.TOKEN, _accessToken);
String result = _facebook.request("me/notifications", bundle, "GET");
然后你需要解析字符串“result”。它采用json格式。下面是一个例子:
JSONObject jsonObjectResults = new JSONObject(result);
JSONArray jsonNotificationDataArray = jsonObjectResults.getJSONArray("data");
for (int i=0;i<jsonNotificationDataArray.length();i++)
{
JSONObject jsonNotificationData = jsonNotificationDataArray.getJSONObject(i);
if (_debug) Log.v("Title: " + jsonNotificationData.getString("title"));
}
我希望你觉得这个很有用。
0
这是一个老问题,但我会后我如何从Facebook的通知,如果有人发现了它有用
if(session.isOpened()){
String aaa=new String();
aaa="SELECT title_text,updated_time FROM notification WHERE recipient_id=me() AND is_unread=1";
Bundle params = new Bundle();
params.putString("q", aaa);
new Request(session,"/fql",params,HttpMethod.GET,new Request.Callback() {
public void onCompleted(Response response) {
try
{
GraphObject go = response.getGraphObject();
JSONObject jso = go.getInnerJSONObject();
JSONArray arr = jso.getJSONArray("data");
String splitting=arr.toString().replaceAll("\\\\|\\{|\\}|\\[|\\]", "");
String[] arrayresponse=splitting.split("\\,");
String s = "";
for (int i = 0; i < arrayresponse.length; i++) {
if (arrayresponse[i].length()>13){
if (arrayresponse[i].substring(1,13).equals("updated_time"))
s+="* "+getDate(Long.valueOf(arrayresponse[i].substring(15,arrayresponse[i].length())))+"\n";
else
s+=" "+arrayresponse[i].substring(14,arrayresponse[i].length()-1)+"\n\n";
}
}
text2.setVisibility(View.VISIBLE);
NotificationMessage.setVisibility(View.VISIBLE);
NotificationMessage.setMovementMethod(new ScrollingMovementMethod());
NotificationMessage.setText(s);
readMailBox(session);
}catch (Throwable t)
{
t.printStackTrace();
}
}
}
).executeAsync();
}
else{
// NotificationMessage.setVisibility(View.INVISIBLE);
Log.i(TAG, "Logged out...");
}
相关问题
- 1. 获取Facebook通知API 3.0
- 2. 如何从Facebook获取通知
- 3. 使用python读取Facebook标记通知
- 4. Facebook图形API - 获取页面通知
- 5. facebook上购买后阿比
- 6. 从Facebook获取用户更新的实时通知
- 7. Facebook Like通知?
- 8. Facebook的通知
- 9. Facebook通知
- 10. Facebook通知API
- 11. 从facebook获取实时api的帖子通知
- 12. 发送android应用程序通知到Facebook使用Facebook API通知
- 13. 如何将Facebook通知标记为通过Facebook API读取?
- 14. 使用Android从Facebook获取信息
- 15. 使用IOS SDK从Facebook获取数据
- 16. 使用API从Facebook获取旧记录
- 17. 使用NodeJS从Facebook获取user_likes和user_posts
- 18. Facebook中的通知
- 19. 发送Facebook通知
- 20. 发送Facebook通知
- 21. Android Facebook SDK - 如何查询Facebook通知
- 22. 如何使用Facebook API发送通知?
- 23. 如何通过Graph API获取Facebook页面通知
- 24. #324 Facebook的错误阿比v.2.10cc
- 25. 从Facebook获取ID PHP SDK
- 26. 从node_load获取Facebook内容()
- 27. 从Facebook Graph API获取Mutual_Likes
- 28. 从Facebook获取活动?
- 29. 从URL获取Facebook access_token
- 30. Facebook的 - 通过API获取用户名
这个代码需要manage_notification permission.may请你帮me.how做我分配此权限。谢谢 – 2014-06-04 13:00:04