如何避免在Android Facebook SDK中显示已经授权的应用程序对话框

如何避免在Android Facebook SDK中显示已经授权的应用程序对话框,第1张

概述当我使用Facebook的 Android SDK单点登录时,我得到一个完全无用的页面. "You have already authorized app. Press "Okay" to continue. 此页面会破坏用户体验.如何删除此屏幕? 提前致谢. 注意:如果FB应用程序安装在设备中,我们将不会看到此问题.仅当FB应用程序在设备中不可用时才会引发此问题. 我正在使用最新的Faceboo 当我使用Facebook的 Android SDK单点登录时,我得到一个完全无用的页面.
"You have already authorized app. Press "Okay" to continue.

此页面会破坏用户体验.如何删除此屏幕?

提前致谢.

注意:如果FB应用程序安装在设备中,我们将不会看到此问题.仅当FB应用程序在设备中不可用时才会引发此问题.

解决方法 我正在使用最新的Facebook SDK 3.6我相信并且已经在HTC One& amp; galaxy s3 mini.此页面在任何时候都不会显示给我.我在这里遵循API指南……

https://developers.facebook.com/docs/facebook-login

这是代码…也许这可能会有所帮助.

public class LoginHandlerFrag extends Fragment {    private UilifecycleHelper uiHelper;    private static final String TAG = "HomeFragment";    // private ProfilePictureVIEw profilePictureVIEw;    private Session.StatusCallback callback = new Session.StatusCallback() {        @OverrIDe        public voID call(Session session,SessionState state,Exception exception) {            onSessionStateChange(session,state,exception);        }    };    @OverrIDe    public VIEw onCreateVIEw(LayoutInflater inflater,VIEwGroup container,Bundle savedInstanceState) {        VIEw vIEw = inflater.inflate(R.layout.fragment_login,container,false);        Loginbutton authbutton = (Loginbutton) vIEw                .findVIEwByID(R.ID.authbutton);        authbutton.setReadPermissions(Arrays.asList("email","user_location","user_birthday","user_likes","user_photos"));        authbutton.setFragment(this);        Settings.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS);        return vIEw;    }    private voID makeMeRequest(final Session session) {        // Make an API call to get user data and define a        // new callback to handle the response.        Request request = Request.newMeRequest(session,new Request.GraphUserCallback() {                    @OverrIDe                    public voID onCompleted(GraphUser user,Response response) {                        // If the response is successful                        if (session == Session.getActiveSession()) {                            if (user != null) {                                // profilePictureVIEw.setProfileID(user.getID());                            }                        }                        if (response.getError() != null) {                            // Handle errors,will do so later.                        }                    }                });        request.executeAsync();    }    @OverrIDe    public voID onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        uiHelper = new UilifecycleHelper(getActivity(),callback);        uiHelper.onCreate(savedInstanceState);    }    private voID onSessionStateChange(Session session,Exception exception) {        session = Session.getActiveSession();        SharedPreferences storedPrefs = PreferenceManager                .getDefaultSharedPreferences(getActivity().getApplicationContext());        SharedPreferences.Editor editor = storedPrefs.edit();        editor.putBoolean("userLoggedTracker",true);        editor.commit();        if (state.isOpened()) {            Log.i(TAG,"Logged in...");            makeMeRequest(session);            editor.putBoolean("userLoggedTracker",false);            editor.commit();            getVIEw().setVisibility(VIEw.GONE);        } else if (state.isClosed()) {            Log.i(TAG,"Logged out...");            editor.putBoolean("userLoggedTracker",true);            editor.commit();            getVIEw().setVisibility(VIEw.VISIBLE);        }    }    @OverrIDe    public voID onResume() {        super.onResume();        Session session = Session.getActiveSession();        if (session != null && (session.isOpened() || session.isClosed())) {            onSessionStateChange(session,session.getState(),null);        }        uiHelper.onResume();    }    @OverrIDe    public voID onActivityResult(int requestCode,int resultCode,Intent data) {        super.onActivityResult(requestCode,resultCode,data);        uiHelper.onActivityResult(requestCode,data);    }    @OverrIDe    public voID onPause() {        super.onPause();        uiHelper.onPause();    }    @OverrIDe    public voID onDestroy() {        super.onDestroy();        uiHelper.onDestroy();    }    @OverrIDe    public voID onSaveInstanceState(Bundle outState) {        super.onSaveInstanceState(outState);        uiHelper.onSaveInstanceState(outState);    }}
总结

以上是内存溢出为你收集整理的如何避免在Android Facebook SDK中显示已经授权的应用程序对话框全部内容,希望文章能够帮你解决如何避免在Android Facebook SDK中显示已经授权的应用程序对话框所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1139192.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存