Facebook图形Api,如何设置隐私设置
我有一个带有微调器的自定义白名单,可以选择谁可以在userwall上看到我们的帖子,我想选择并在我的墙上发表,但是不确定如何将隐私设置放入wall并发送.
I have a custom dailog with a spinner to choose who can see our post on userwall, i want to choose and post on my wall, but not sure how to put privacy settings in wall and send it.
getId = getfbId(id);
if (getId != null) {
String url = Constants.fbindexURL + "lang=" + lang + "&lat=" + lat + "&getfbid=" + getId;
myplace = Constants.loadedplace.getCityName();
parameters.putString("name", getString(R.string.reply));
parameters.putString("caption", fbUuer + " in " + Constants.loadedplace.getCityName());
parameters.putString("link", url);
parameters.putString("picture", Constants.ImageURL);
//------------> parameters.putString("privacy", );
下面是获取微调器值的代码
below is code for getting the values of my spinner
spinner = (Spinner)dialog.findViewById(R.id.spinner);
spinner.setOnItemSelectedListener(new Adapter
View.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
String choose = spinner.getSelectedItem().toString();
}
public void onNothingSelected(AdapterView<?> parent) {
}
});
有人可以建议我如何选择从微调器中看到的人并相应地张贴在我的墙上.感谢您的帮助
can someonesuggest how can i choose who to see from the spinner and post accordingly on my wall. Any help is appreciated
两个Facebook文档在这里很重要:
Two Facebook documents are of importance here:
- https://developers.facebook.com/docs/reference/api/user /(向下滚动至页面末尾以查看 POSTS-创建部分.)
- https://developers.facebook.com/docs/reference/api /privacy-parameter/
- https://developers.facebook.com/docs/reference/api/user/ (Scroll down almost to the end of the page to see the POSTS - Create section.)
- https://developers.facebook.com/docs/reference/api/privacy-parameter/
这里的重点是,您只能为自己墙上的帖子选择其他隐私设置".更重要的是,用户必须自己主动选择隐私.当用户首次选择应用程序的权限时,您不能覆盖该用户选择的默认设置. (在其帐户设置中可用的)
要更改单个帖子的隐私,例如,如果您只需要公开一个帖子,则需要在您的参数中添加该帖子:
To change the privacy of an individual post, for example, if you need to make a Post available only to you, you will need to include this in your parameters:
注意:隐私设置必须位于JSON对象中.
privacy={'value':'SELF'}
用法示例:
JSONObject jsonObject = new JSONObject();
jsonObject.put("value", "SELF");
parameters.putString("privacy", jsonObject.toString());
上面提到的第二个链接将提供更多详细信息.请阅读所有内容,以更好地配置您的应用.
The second link mentioned above has more details which will be of use. Do read them all for better configuring your app.
建议:
要在FB上选择希望允许该帖子可见的朋友,可以在此处使用此示例从GridView
中选择多个用户:
Suggestion:
For selecting friends on FB that you wish to allow the post to be visible, you can use this example here for selecting multiple users from a GridView
: http://vikaskanani.wordpress.com/2011/07/20/android-custom-image-gallery-with-checkbox-in-grid-to-select-multiple/