[英]Share Status on facebook visible to limited users
我正在使用以下方法在Facebook上分享狀態。
if (facebook.isSessionValid()) {
Bundle parameters = new Bundle();
parameters.putString("message", msg);
try {
String response = facebook.request("me/feed", parameters,"POST");
System.out.println(response);
Toast.makeText(context, "Posted Successfully", Toast.LENGTH_LONG).show();
} catch (IOException e) {
e.printStackTrace();
}
} else {
login();
}
我檢查了具有參數allow =“ profileid1,profileid2,profileid3”的圖形API,但它嵌入在object中。 現在我找不到如何在bundle中添加此參數。
這就是圖形api資源管理器顯示結果的方式。
"privacy": {
"description": "Friends; Except: Artemas Ali, Artemas Ali",
"value": "CUSTOM",
"friends": "ALL_FRIENDS",
"networks": "",
"allow": "",
"deny": "1000036022153129,1000017534323389"
},
通過簡單地將值添加到JSON對象,然后將其轉換為字符串以將值傳遞給API,就可以做到這一點。
if (facebook.isSessionValid()) {
Bundle parameters = new Bundle();
parameters.putString("message", msg);
if(!customUsers.equals("")){
JSONObject obj= new JSONObject();
try {
obj.put("value", "CUSTOM");
obj.put("friends", "ALL_FRIENDS");
try{
obj.put("deny", customUsers);
}catch(StringIndexOutOfBoundsException ex){
Log.d(customUsers, ex.toString());
}
} catch (JSONException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
parameters.putString("privacy", obj.toString());
}
try {
String response = facebook.request("me/feed", parameters,"POST");
System.out.println(response);
Toast.makeText(context, "Posted Successfully", Toast.LENGTH_LONG).show();
} catch (IOException e) {
e.printStackTrace();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.