2016-08-15 7 views
2

私が欲しいのはアンドロイドアプリケーションからステータスを投稿することです。そのステータスには画像が含まれており、そこにはタグが付けられています。タグ付きの人物または写真付きの人物でステータスを投稿すると、それは絶対にうまくいきます。問題は、タグ付きの写真を追加してfbに投稿すると、私のプロフィールに何も表示されないときに起こります。友人タグ付きグラフAPI写真アップロード

btn_submit.setOnClickListener(new View.OnClickListener() { 
     @Override 
     public void onClick(View v) { 
      for (String s : user_friends_id) { 
       ids += s + ","; 
      } 
      if (etxt_status.getText().toString().equals("")) { 
       Toast.makeText(FacebookStatusUpdate.this, "Status is Empty", Toast.LENGTH_SHORT).show(); 
      } else /*if (bitmapdata != null)*/ { 
       btn_submit.setVisibility(View.GONE); 
       user_status = etxt_status.getText().toString(); 
       Bundle params = new Bundle(); 
       params.putString("caption", etxt_status.getText().toString()); 
       params.putString("place", user_loc_id); 
       params.putString("tags", ids); 
       params.putByteArray("picture", bitmapdata); 

       new GraphRequest(
         AccessToken.getCurrentAccessToken(), 
         "/" + user_fb_id + "/photos", 
         params, 
         HttpMethod.POST, 
         new GraphRequest.Callback() { 
          public void onCompleted(GraphResponse response) { 
           //new getPlaceId().execute(); 
           JSONObject o = response.getJSONObject(); 
           try { 
            user_status_id = o.getString("id"); 
           } catch (Exception ex) { 

           } finally { 
            new insertCheckinDetails().execute(); 
           } 
           Toast.makeText(FacebookStatusUpdate.this, "Status Updated", Toast.LENGTH_SHORT).show(); 
          } 
         } 
       ).executeAsync(); 
      } 
     } 
    }); 
    url_paging = new ArrayList<>(); 
    friends = new ArrayList<>(); 
    fb_name = new ArrayList<>(); 
    fb_id = new ArrayList<>(); 
    fb_images = new ArrayList<>(); 
    ls_json_obj = new ArrayList<>(); 
    new abc().execute(); 
} 

このリンクを使用していますが、動作しません。

答えて

0

あなたのコードは友だちタグなしでFacebookに画像をアップロードして、画像に友達にタグを付けて次の変更を加える必要があります。

String tagFriendListId=""; 
for(int i=0;i<user_friends_id.size();i++) 
{ 
    tagFriendListId = tagFriendListId+"   {'tag_uid':'"+user_friends_id.get(i)+"'} ,"; 
} 
tagFriendListId=tagFriendListId.substring(0,  tagFriendListId.length()-1); 

params.putString("tags","["+tagFriendListId+"]"); 

for (String s : user_friends_id) { 
    ids += s + ","; 
} 

params.putString("tags", ids); 

を交換してください

関連する問題