Note that there are some explanatory texts on larger screens.

plurals
  1. POPost images from android applications to facebook applications-wall
    text
    copied!<p>I'm trying to publish images created by the user with my Android app to the application wall on Facebook. I already know how to publish the images on the user's wall. </p> <p>I found this tutorial of how to do it with php:<br> <a href="http://jorgealbaladejo.com/2011/06/13/publish-to-facebook-page-or-applications-wall-with-php/" rel="nofollow">http://jorgealbaladejo.com/2011/06/13/publish-to-facebook-page-or-applications-wall-with-php/</a></p> <p>But I don't know how to obtain the <strong>page_id</strong> or how to do it with the Facebook sdk for Android.</p> <hr> <p><strong>EDIT</strong></p> <p>My code for post on facebook wall is:</p> <pre><code>public void postImageonWall(String path) { byte[] data = null; Bitmap bi = BitmapFactory.decodeFile(path); ByteArrayOutputStream baos = new ByteArrayOutputStream(); bi.compress(Bitmap.CompressFormat.JPEG, 100, baos); data = baos.toByteArray(); Facebook facebook = ((MainActivity) appcontext).getFacebook(); Log.d("Facebook-PostImage","facebook: " + facebook); Bundle params = new Bundle(); params.putString(Facebook.TOKEN, facebook.getAccessToken()); params.putString("method", "photos.upload"); params.putString("message", "Message Text"); params.putString("link","ANDROID_MARKET_LINK"); //or any other link params.putString("name", "APP/GAME NAME"); params.putByteArray("picture", data); Log.d("Facebook-PostImage","AsyncRunner going to be called"); AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook); mAsyncRunner.request(null, params, "POST", new RequestListener() { public void onComplete(final String response, final Object state) { try { // process the response here: (executed in background thread) Log.d("Facebook-Example", "Response: " + response.toString()); JSONObject json = Util.parseJson(response); final String src = json.getString("src"); // 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 in response"); } catch (FacebookError e) { Log.w("Facebook-Example", "Facebook Error: " + e.getMessage()); } } @Override public void onFacebookError(FacebookError e, Object state) { // TODO Auto-generated method stub } @Override public void onIOException(IOException e, Object state) { // TODO Auto-generated method stub } @Override public void onFileNotFoundException(FileNotFoundException e, Object state) { // TODO Auto-generated method stub } @Override public void onMalformedURLException(MalformedURLException e, Object state) { // TODO Auto-generated method stub } }, null); } </code></pre>
 

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