![](/img/trans.png)
[英]How to tag a friend, while post on wall using facebook sdk android
[英]Tag Friend in Picture using Facebook API in Android
我在使用Android API中的Facebook API在圖片中標記朋友時遇到問題。 這就是我現在所擁有的
Bundle param;
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(),R.drawable.picture);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte[] data = stream.toByteArray();
AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);
InputStream is = null;
param = new Bundle();
param.putString("message", dataMsg);
param.putString("filename", "Invite");
String[] numArr = invitedNum.toArray(new String[invitedNum.size()]);
param.putStringArray("message_tags",numArr);
param.putByteArray("picture", data);
mAsyncRunner.request("me/photos", param, "POST", new SampleUploadListener(), null);
Toast.makeText(context, "Picture posted to Facebok.", Toast.LENGTH_SHORT).show();
這會上傳圖片並在其上設置消息,但不會在圖片中標記任何人。 任何想法都會非常有用。
要標記用戶,您需要按照此處列出的方法:
https://developers.facebook.com/docs/reference/api/photo/#tags
所以你會:
1 /上傳照片
2 /獲取帶照片的身份證件(如果上傳成功則應退回)
3 /調用此Graph API端點:
PHOTO_ID/tags
並傳入tags參數中的FB ID:
tags=[{"id":"1234"}, {"id":"12345"}].
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.