Note that there are some explanatory texts on larger screens.

plurals
  1. POFacebook uploads two same tagged image on single request to Graph Api.
    primarykey
    data
    text
    <p>I am uploading tagged image to facebook using Graph API. Here is my code :</p> <pre><code>MultipartEntity entity = new MultipartEntity( HttpMultipartMode.BROWSER_COMPATIBLE); HttpClient httpClient = new DefaultHttpClient(); mPostTagUrl = "https://graph.facebook.com/" + dataManager.getOwnerId() + "/photos"; HttpPost httppost = new HttpPost(mPostTagUrl); byte[] data = null; try { try { String mPath = Environment.getExternalStorageDirectory() .toString() + "/" + "screenshot.jpg"; FileInputStream fis = new FileInputStream(mPath); Bitmap bi = BitmapFactory.decodeStream(fis); ByteArrayOutputStream baos = new ByteArrayOutputStream(); bi.compress(Bitmap.CompressFormat.JPEG, 100, baos); data = baos.toByteArray(); } catch (FileNotFoundException e) { e.printStackTrace(); Log.d("onCreate", "debug error e = " + e.toString()); } if (data != null) { ByteArrayBody bab = new ByteArrayBody(data, "event_pic" + ".jpg"); entity.addPart("source", bab); } StringBody mAccesssToken = new StringBody(dataManager .getAccessToken().trim()); entity.addPart("access_token", mAccesssToken); JSONArray mJsonArray = new JSONArray(); JSONObject json; for (int i = 0; i &lt; getAllAddFriends().size(); i++) { final int index = i; String fId = getAllAddFriends().get(index) .getFacebookFriendId(); Log.d("gaurav", "facebook id ==" + fId); try { json = new JSONObject(); json.put("x", "" + position); json.put("y", "" + position); json.put("tag_uid", fId); position = position + 10; mJsonArray.put(i, json); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } String str = new String(mJsonArray.toString()); Log.d("gaurav", "Add event Url=" + str); StringBody mEventNameBody = new StringBody(str); entity.addPart("tags", mEventNameBody); httppost.setEntity(entity); try { httpClient.execute(httppost); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } HttpResponse response = httpClient.execute(httppost); String ret = EntityUtils.toString(response.getEntity()); Log.d("gaurav", "Response Tag Friends =" + ret); } catch (ClientProtocolException e) { // TODO Auto-generated catch block } catch (IOException e) { // TODO Auto-generated catch block } </code></pre> <p>Kindly check my code. I am able to post tagged image , but in facebook same images upload twice in same time. Kindly suggest me on that issue.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload