Xamarin.Auth Google not auto close when done login

梦想与她 提交于 2019-12-10 21:25:58

问题


I follow guide enter link description here

I have a issue when I done login my google account it show toast

And browser not auto close to back my.

Thanks!


回答1:


In you CustomUrlSchemeInterceptorActivity page replace inside OnCreate.

        base.OnCreate(savedInstanceState);          
        global::Android.Net.Uri uri_android = Intent.Data;

        Uri uri_netfx = new Uri(uri_android.ToString());

        // load redirect_url Page
        AuthenticationState.Authenticator.OnPageLoading(uri_netfx);

        var intent = new Intent(this, typeof(MainActivity));
        intent.SetFlags(ActivityFlags.ClearTop | ActivityFlags.SingleTop);
        StartActivity(intent);

        this.Finish();

        return;



回答2:


This is the warning message shown in the toast.

We can make it null by adding a piece of code in MainActivity just after initializing Xamarin.Auth.

CustomTabsConfiguration.CustomTabsClosingMessage = null;

And for closing the CustomTab login screen and navigating back to your app, set the LaunchMode of your Custom URL activity to SingleTask.

LaunchMode = LaunchMode.SingleTask

Hope this will help.




回答3:


Worked for me as well in avoiding the toast: global::Xamarin.Auth.CustomTabsConfiguration.CustomTabsClosingMessage = null



来源:https://stackoverflow.com/questions/47938171/xamarin-auth-google-not-auto-close-when-done-login

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