Note that there are some explanatory texts on larger screens.

plurals
  1. POTag Friends Uploading photo to facebook
    primarykey
    data
    text
    <p>(Sorry for my English).I'm trying to post an photo taken with my app to users Wall, And I had succeed but I can't tag some friends on the post, The image is uploaded and the place tagged correctly, but the friends are not tagged.<br> I had searched on facebook docs and examples but i only find how to post a photo uploaded to a server, not how to upload it to facebook.</p> <p>I Use this code:</p> <pre><code>/** * Posts an image on Facebook user wall. * @param path path of the image to be posted. * @param act activity caller. * @param text description of the photo. */ public void postImageOnWall(final Activity act, final String path, final String text) { if (facebook.isSessionValid()) { byte[] data = null; Bitmap bi = BitmapFactory.decodeFile(path); ByteArrayOutputStream baos = new ByteArrayOutputStream(); bi.compress(Bitmap.CompressFormat.JPEG, 100, baos); data = baos.toByteArray(); StringBuilder str = new StringBuilder(); str.append(text); str.append("\n" + act.getResources().getString( R.string.facebook_signature_android)); str.append("\n" + act.getResources().getString( R.string.facebook_signature_ios)); Bundle params = new Bundle(); params.putString(Facebook.TOKEN, facebook.getAccessToken()); params.putString("link", "www.example.com"); params.putString("place", "--placeId--"); params.putStringArray("to", new String[]{"--friendId1--","--friendId2--"}); params.putStringArray("tags", new String[]{{"--friendId1--","--friendId2--"}); params.putString("name", str.toString()); params.putByteArray("picture", data); AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook); mAsyncRunner.request("me/photos", params, "POST", new RequestListener() { public void onComplete( final String response, final Object state) { try { // process the response here: Log.i("Facebook-Example", "Response: " + response.toString()); JSONObject json = Util.parseJson(response); String id = json.getString("id"); // then post the processed result back to the UI thread // if we do not do this, an runtime exception will be generated // e.g. "CalledFromWrongThreadException: Only the original // thread that created a view hierarchy can touch its views." } catch (JSONException e) { Log.w("Facebook-Example", "JSON Error: " + e.getMessage()); } catch (FacebookError e) { Log.w("Facebook-Example", "Facebook Error: " + e.getMessage()); } } @Override public void onIOException(final IOException e, final Object state) { Log.e("Facebook-Request", "Facebook IOException: " + e.getMessage()); e.printStackTrace(); } @Override public void onFileNotFoundException( final FileNotFoundException e, final Object state) { Log.e("Facebook-Request", "Facebook FileNotFoundException: " + e.getMessage()); e.printStackTrace(); } @Override public void onMalformedURLException( final MalformedURLException e, final Object state) { Log.e("Facebook-Request", "Facebook MalformedURLException: " + e.getMessage()); e.printStackTrace(); } @Override public void onFacebookError(final FacebookError e, final Object state) { Log.e("Facebook-Request", "Facebook FacebookError: " + e.getMessage()); e.printStackTrace(); } }, null); } else { Toast.makeText(act, "Not connected to Facebook", Toast.LENGTH_LONG).show(); } } </code></pre> <p>Yesterday I downloaded the facebook SDK 3 and now the mAsyncRunner.request() method is deprecated, and I can not figure how to do it with the new sdk.</p> <p>If Anyone can help me to figure out why the friends aren't tagged or what is the new method for doing the same post I will be really grateful</p>
    singulars
    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