Hi everybody.
I am trying to use xamarin.auth in a cross-platform application through a pageRendered and it connects with Facebook fine, but when come back, it crash.
This is the call to the pageRendered code:------------------------------------------------------------------------
using System;
using Xamarin.Forms;
namespace Beetuit_APP
{
public class BaseContentPage : ContentPage
{
protected override void OnAppearing ()
{
base.OnAppearing ();
if (!App.IsLoggedIn) {
Navigation.PushModalAsync (new LoginPage ());
}
}
}
}
This is the page Rendered code:---------------------------------------------------------------------------------------------------------------------
using System;
using Beetuit_APP;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
using Android.App;
using Xamarin.Auth;
using System.Diagnostics;
[assembly: ExportRenderer (typeof (LoginPage), typeof (LoginPageRenderer))]
namespace Beetuit_APP
{
public class LoginPageRenderer: Xamarin.Forms.Platform.Android.PageRenderer
{
protected override void OnElementChanged (ElementChangedEventArgs<Page> e)
{
base.OnElementChanged (e);
// this is a ViewGroup - so should be able to load an AXML file and FindView<>
var activity = this.Context as Activity;
var auth = new OAuth2Authenticator (
clientId: "xxxxxxxxxxx",
scope: "xxxxx",
authorizeUrl: new Uri ("xxxxxxx"),
redirectUrl: new Uri ("xxxxxxx"));
auth.Completed += (sender, eventArgs) => {
if (eventArgs.IsAuthenticated) {
// Use eventArgs.Account to do wonderful things
App.SaveToken(eventArgs.Account.Properties["access_token"]);
Console.WriteLine(App.Token);
App.SuccessfulLoginAction.Invoke();
} else {
// The user cancelled
}
};
activity.StartActivity(auth.GetUI(activity));
}
}
}
This is the invoked action: ------------------------------------------------------------------------
public static Action SuccessfulLoginAction
{
get {
return new Action (() => {
mainNav.Navigation.PopModalAsync();
});
}
}
And this is the error:
[WindowManager] android.view.WindowLeaked: Activity xamarin.auth.WebAuthenticatorActivity has leaked window com.android.org.chromium.content.browser.input.PopupTouchHandleDrawable{1dffba60 V.ED.... ........ 0,0-60,72} that was originally added here
[WindowManager] at android.view.ViewRootImpl.(ViewRootImpl.java:363)
[WindowManager] at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:261)
[WindowManager] at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
[WindowManager] at android.widget.PopupWindow.invokePopup(PopupWindow.java:1058)
[WindowManager] at android.widget.PopupWindow.showAtLocation(PopupWindow.java:887)
[WindowManager] at android.widget.PopupWindow.showAtLocation(PopupWindow.java:851)
[WindowManager] at com.android.org.chromium.content.browser.input.PopupTouchHandleDrawable.show(PopupTouchHandleDrawable.java:334)
[WindowManager] at com.android.org.chromium.android_webview.AwContents.nativeOnDraw(Native Method)
[WindowManager] at com.android.org.chromium.android_webview.AwContents.access$4300(AwContents.java:84)
[WindowManager] at com.android.org.chromium.android_webview.AwContents$AwViewMethodsImpl.onDraw(AwContents.java:2344)
[WindowManager] at com.android.org.chromium.android_webview.AwContents.onDraw(AwContents.java:1057)
[WindowManager] at com.android.webview.chromium.WebViewChromium.onDraw(WebViewChromium.java:1671)
[WindowManager] at android.webkit.WebView.onDraw(WebView.java:2384)
[WindowManager] at android.view.View.draw(View.java:15114)
[WindowManager] at android.view.View.updateDisplayListIfDirty(View.java:14048)
[WindowManager] at android.view.View.getDisplayList(View.java:14071)
[WindowManager] at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3388)
[WindowManager] at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3367)
[WindowManager] at android.view.View.updateDisplayListIfDirty(View.java:14008)
[WindowManager] at android.view.View.getDisplayList(View.java:14071)
[WindowManager] at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3388)
[WindowManager] at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3367)
[WindowManager] at android.view.View.updateDisplayListIfDirty(View.java:14008)
[WindowManager] at android.view.View.getDisplayList(View.java:14071)
[WindowManager] at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3388)
[WindowManager] at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3367)
[WindowManager] at android.view.View.updateDisplayListIfDirty(View.java:14008)
[WindowManager] at android.view.View.getDisplayList(View.java:14071)
[WindowManager] at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:266)
[WindowManager] at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:272)
[WindowManager] at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:311)
[WindowManager] at android.view.ViewRootImpl.draw(ViewRootImpl.java:2492)
[WindowManager] at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2337)
[WindowManager] at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1968)
[WindowManager] at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
[WindowManager] at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
[WindowManager] at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
[WindowManager] at android.view.Choreographer.doCallbacks(Choreographer.java:580)
[WindowManager] at android.view.Choreographer.doFrame(Choreographer.java:550)
[WindowManager] at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
[WindowManager] at android.os.Handler.handleCallback(Handler.java:739)
[WindowManager] at android.os.Handler.dispatchMessage(Handler.java:95)
[WindowManager] at android.os.Looper.loop(Looper.java:135)
[WindowManager] at android.app.ActivityThread.main(ActivityThread.java:5221)
[WindowManager] at java.lang.reflect.Method.invoke(Native Method)
[WindowManager] at java.lang.reflect.Method.invoke(Method.java:372)
[WindowManager] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
[WindowManager] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
[BindingManager] Cannot call determinedVisibility() - never saw a connection for the pid: 28942
[System.err] java.lang.IllegalArgumentException: View=com.android.org.chromium.content.browser.input.PopupTouchHandleDrawable{1dffba60 I.ED.... ........ 0,0-60,72} not attached to window manager
[System.err] at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:386)
[System.err] at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:312)
[System.err] at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:84)
[System.err] at android.widget.PopupWindow.dismiss(PopupWindow.java:1356)
[System.err] at com.android.org.chromium.content.browser.input.PopupTouchHandleDrawable.hide(PopupTouchHandleDrawable.java:341)
[System.err] at com.android.org.chromium.content.browser.ContentViewCore.nativeDismissTextHandles(Native Method)
[System.err] at com.android.org.chromium.content.browser.ContentViewCore.dismissTextHandles(ContentViewCore.java:2142)
[System.err] at com.android.org.chromium.content.browser.ContentViewCore.hidePopups(ContentViewCore.java:1382)
[System.err] at com.android.org.chromium.content.browser.ContentViewCore.hidePopupsAndClearSelection(ContentViewCore.java:1354)
[System.err] at com.android.org.chromium.content.browser.ContentViewCore.access$1300(ContentViewCore.java:102)
[System.err] at com.android.org.chromium.content.browser.ContentViewCore$3.didNavigateMainFrame(ContentViewCore.java:740)
[System.err] at com.android.org.chromium.content.browser.WebContentsObserver.didNavigateMainFrame(WebContentsObserver.java:81)
[System.err] at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
[System.err] at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:53)
[System.err] at android.os.Handler.dispatchMessage(Handler.java:102)
[System.err] at android.os.Looper.loop(Looper.java:135)
[System.err] at android.app.ActivityThread.main(ActivityThread.java:5221)
[System.err] at java.lang.reflect.Method.invoke(Native Method)
[System.err] at java.lang.reflect.Method.invoke(Method.java:372)
[System.err] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
[System.err] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
[chromium] [FATAL:jni_android.cc(269)] Check failed: false. Please include Java exception stack in crash report
[chromium] ### WebView Version 40 (1808730-arm) (code 423501)
[libc] Fatal signal 6 (SIGABRT), code -6 in tid 28942 (APP.Beetuit_APP)
I am desperate with this.
Help me, please.
Regards.
Ángel