获得通知从Facebook使用Facebook阿比 [英] Get Notification From Facebook Using Facebook Api

查看:162
本文介绍了获得通知从Facebook使用Facebook阿比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要的Facebook的通知...
我使用的本实阿比..

I want notification of facebook... I am using this facebook Api..

和我想在我的应用程序此通知。
任何一个知道如何获得通知。

and i want this notification in my application. any one know how to get notification ..

推荐答案

这是我如何才能使用Facebook SDK的Andr​​oid通知。在code以下被登录的/身份验证的用户通知。

This is how I get notifications using the Facebook SDK for Android. The code below gets the logged in/authenticated users notifications.

//Initialze your Facebook object, etc.
Facebook _facebook = ...
...
Bundle bundle = new Bundle();
bundle.putString(Facebook.TOKEN, _accessToken);
String result = _facebook.request("me/notifications", bundle, "GET");

然后,你将需要解析字符串结果。这是JSON格式。这里是什么看起来像一个例子:

Then you will need to parse the string "result". It's in json format. Here is an example of what that will look like:

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"));
}

我希望你发现这很有用。

I hope that you find this useful.

这篇关于获得通知从Facebook使用Facebook阿比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆