boss
boss

Reputation: 1606

post a photo to friend's wall on facebook with android

I am trying to post photo to my friend's wall.. I can do it as well but there is a problem. Anyone cant see it. I mean this photo shows only friend's wall.. not mine or not others friend.. I used some permissions but maybe I missed something..

 private static final String[] PERMS = new String[] {"manage_pages", "read_insights", "user_checkins", "user_birthday","friends_birthday","email","user_photos","publish_checkins","publish_actions", "read_stream" ,"publish_stream","read_friendlists"};

and here is my codes..

            public void postPhoto() {

            String accessToken = mFacebook.getAccessToken();
            params.putString("message", message); 
            params.putString("target_id", friendID); 
            params.putString(Facebook.TOKEN, accessToken);      
            response= mFacebook.request(friendID" + "/photos", params, "POST");
            response = "{\"data\": [" + response + "] }";
            String photoID = GetIDPhoto(response);

            setTag(photoID, friendID);  
          }

private void setTag(String photoID,String friendID) {

    String relativePath = photoID + "/tags/" + friendID;
    Bundle params = new Bundle();
    params.putString("x", "30");
    params.putString("y", "30");
    String response ="";

    try {
        response = mFacebook.request(relativePath, params, "POST");
    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    Toast.makeText(getApplicationContext(), response, 3000).show();

 }

Where is my mistake?

Upvotes: 2

Views: 705

Answers (1)

AllardChris
AllardChris

Reputation: 11

This seems to be your first problem, I haven't gone through the rest yet, I stopped at this:

response= mFacebook.request(friendID" + "/photos", params, "POST");
        response = "{\"data\": [" + response + "] }";

Unless I'm mistaken, you seem to have some issues with your quotes.

Upvotes: 1

Related Questions