Xamarin Firebase Android Dynamic Link Error

장주명 41 Reputation points
2021-11-13T12:28:04.557+00:00

I am making a dynamiclink of firebase using xamarin. But there is a problem.

The application receives, but does not move to the desired page.

In Onsleep state, clicking dynamicLink opens the app, but the desired page does not open.

Then, if i close the app and run the app again, all the pages that have been pushed are displayed.

And if the dynamicLink has never been clicked in Onsleep state, the application will only show one page linked to dynamicLink, not the main page.

What's the problem?

Here is my code.

  protected override void OnCreate(Bundle savedInstanceState)
    {


      FirebaseDynamicLinks.Instance.GetDynamicLink(Intent).AddOnSuccessListener(this, new OnSuccessListner());
}

 public class OnSuccessListner : Java.Lang.Object, IOnSuccessListener
    {
        void IOnSuccessListener.OnSuccess(Java.Lang.Object result)
         {
            var link = result.JavaCast<PendingDynamicLinkData>();
            Android.Net.Uri deeplink = null;
            if (link != null)
            {
                Logger.Instance.Write("received");
                deeplink = link.Link;
                Logger.Instance.Write($"{deeplink}");

                if (StaticDatas.IsLoggedIn)
                {
                    App.Current.MainPage.Navigation.PushAsync(new DynamicWebView(deeplink.ToString(), "LinkPage"));
                } else
                {
                    StaticDatas.DeepLink = deeplink.ToString();
                } 
            }
        }

    }
Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
4,813 questions
{count} votes