0

USE the facebook-android-sdk 4.8.1

i want use GameRequestContent API send a games request to friend

 i have a real id for my friend ,then i call GameRequestContent a to send a game request

like this

GameRequestContent content = new GameRequestContent.Builder().setMessage("Come play this level with me")
                             .setData("hello")
                             .setRecipients(Arrays.asList("117157035316159"))
                             .setActionType(GameRequestContent.ActionType.SEND)
                             .setObjectId("117157035316159")
                             .build();
                     GameRequestDialog g = new GameRequestDialog(getActivity());
                     g.registerCallback(callbackManager, new FacebookCallback<GameRequestDialog.Result>() {
                         @Override
                         public void onSuccess(GameRequestDialog.Result o) {

                             Log.i("onSuccess", o.toString());
                         }

                         @Override
                         public void onCancel() {
                             Log.i("onSuccess", "onCancel");
                         }

                         @Override
                         public void onError(FacebookException error) {
                             Log.i("onError", error.getMessage());
                             error.printStackTrace();
                         }
                     });
                     g.show(content);

i has try put user name into recipients aways Failed but !!! a error message response for me : { httpResponseCode: -1, facebookErrorCode: 2, facebookErrorType: null, message: 抱歉,此功能现在不可用: 处理此请求时发生错误,请稍后再试(the function is Not available at now,hava a error when handle the request, please try agin later)

i hope to know why~ how can i do for

jun xia
  • 137
  • 1
  • 6
  • I cannot see any method called `setRecipients` in the [`GameRequestContent.Builder` docs](https://developers.facebook.com/docs/reference/android/4.7/class/GameRequestContent.Builder). Which version of sdk are you using? Please check the corresponding docs. – FelisCatus Nov 13 '15 at 05:44
  • Got it in [the current docs](https://developers.facebook.com/docs/reference/android/current/class/GameRequestContent.Builder/#setRecipients). It says: An array of user IDs, usernames or invite tokens of people to send request. – FelisCatus Nov 13 '15 at 07:26
  • Did you really pass a valid facebook user ID into the List? Can you try usernames or invite tokens instead? – FelisCatus Nov 13 '15 at 07:27
  • i must put facebook user id into recipients ,but how i to do get a vaild facebook user ID? GraphRequest API get the user id is not ture facebook user id ,it dose Encrypted – jun xia Nov 13 '15 at 08:07
  • If you don't have a valid facebook user ID, then I'm afraid this question is not in the scope of programming anymore. Try to find some other API that gives you real IDs, or exchanges Graph IDs for fbids. – FelisCatus Nov 13 '15 at 08:45
  • yeah ,this question is fixed, if want get real ids must call me/friends api, return the friends was bind your app. – jun xia Nov 16 '15 at 02:56

0 Answers0