Facebook friend dialog not working on mobile

我与影子孤独终老i 提交于 2019-12-04 10:51:51
Rahul Tripathi

As answered by Wimagguc in this question you may try this:-

The underlying problem is that the Facebook API is not yet ready for all the display types, and the friends dialog cannot be shown for the mobile display.

protected static String DIALOG_BASE_URL = "https://m.facebook.com/dialog/";
protected static String DIALOG_BASE_URL_FOR_MISSING_SCREENS = "https://www.facebook.com/dialog/";

public void dialog(Context context, String action, Bundle parameters,
        final DialogListener listener) {

    boolean missingScreen = action.contentEquals("friends") ? true : false;

    String endpoint = missingScreen ? DIALOG_BASE_URL_FOR_MISSING_SCREENS : DIALOG_BASE_URL;
    endpoint += action;

    parameters.putString("display", missingScreen ? "popup" : "touch");
    parameters.putString("redirect_uri", REDIRECT_URI);

    if (action.equals(LOGIN)) {
        parameters.putString("type", "user_agent");
        parameters.putString("client_id", mAppId);
    } else {
        parameters.putString("app_id", mAppId);
    }

    if (isSessionValid()) {
        parameters.putString(TOKEN, getAccessToken());
    }
    String url = endpoint + "?" + Util.encodeUrl(parameters);
    if (context.checkCallingOrSelfPermission(Manifest.permission.INTERNET)
            != PackageManager.PERMISSION_GRANTED) {
        Util.showAlert(context, "Error",
                "Application requires permission to access the Internet");
    } else {
        new FbDialog(context, url, listener).show();
    }
}

Facebook decided that the bug has no priority and changed the status to "Won't Fix" at December 7th, 2013.

The original bug report was marked as a duplicate of https://developers.facebook.com/x/bugs/309157325894924/. See this page for more info.

I think this is a shame and I would still like to urge anyone who thinks the same to open a new bugreport for the issue. Or leave a comment on the report stated above. Since this seems to be the only way to create some sense of urgency for solving this problem.

PS: I recommend a bugreport since my comments were deleted lately.

PS2: Even my bugreport "to state the won't fix issue in the documentation" seems to be ignored. So every day new people will research the possibilities of a mobile web app with a connection to facebook and will wrongly assume they can use the "facebook friend dialog" in their web app on mobile devices. My hope is that they will find this page during their research, and steer clear off that assumption.

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