Facebook Android SDK, graph api >3.2 and 4.0 sending app request issue

元气小坏坏 提交于 2019-12-09 23:39:19

问题


I am trying to send app request to my facebook friend after authentication by using the following code snippet.

public void sendApplicationRequest(final List<String> userIdList, final String message, final String title, final int requestCode) {
    final Bundle parameters = new Bundle();
    parameters.putString("title", title);
    parameters.putString("message", message);
    parameters.putInt("requestCode", requestCode);
    parameters.putString("frictionless", "1");
    String to = getListOfUsersAsString(userIdList);
    if (to != null) {
        parameters.putString("to", to);
    }
    activity.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            WebDialog requestDialog = createRequestDialog(parameters);
            requestDialog.setOwnerActivity(activity);
            requestDialog.show();
        }
    });
}

private WebDialog createRequestDialog(final Bundle parameters) {
    final int requestCode = parameters.getInt("requestCode");
    return (
            new WebDialog.Builder( activity, "apprequests", parameters))
            .setOnCompleteListener(new WebDialog.OnCompleteListener() {
                @Override
                public void onComplete(Bundle bundle, FacebookException e) {
                    //...
                }
            }
            ).build();
}

The problem is, the dialog shows on top of my app's activity but it requires authentication again. When I enter my credentials and login to facebook on the dialog, everything works well but players have to log in on every app request again and again.

I have also tried the new GameRequestDialog and GameRequestContent API's but the result is the same.

Do you have an idea about what is the problem here which force me to authenticate again on every web dialog?


Correction : After authenticating on the web dialog for the first time, it never forces you to authenticate again. But still, players need to authenticate two times in total.

来源:https://stackoverflow.com/questions/57709126/facebook-android-sdk-graph-api-3-2-and-4-0-sending-app-request-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!