Open new Page after redirect to application

pauldanut94pauldanut94 Member ✭✭
edited October 18 in Xamarin.iOS

Hi everyone,

I have an Xamarin.Forms Android/iOS app. I start the app, and it starts with the MainPage, where I have a button and when I press it an web page is started (for OAuth2.0 Authentication). I do the steps there and at final the browser redirects to my app, but I don't wanna display the MainPage, I want to display another Page, to look like the user is logged in. I've tried to do this with something like that:

 public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)
        {
        //do something with data from url
        LoadApplication(new App(type, value));
            return true;
        } 

Now in the App I've tried to do something like this:

  if (!type.Equals("osapp"))
            {
                MainPage = new NavigationPage(new MainPage(type, value));
            }
            else
            {
                Application.Current.MainPage = new NavigationPage(new SignaturePage(value));

          } //if type is osapp, then I want to open other page (SignaturePage), not MainPage.

I've also tried to open MainPagehere and inOnAppearing() of MainPage:
if (_type.Equals("osapp"))
{
if (!string.IsNullOrWhiteSpace(_value))
{
Navigation.PushAsync(new SignaturePage(_value));
}
}

But each time, the page which opens after the redirect is MainPage. I've no other ideas.
Can anyone help me?

I mention that I could redirect from browser to my app by setting Identifier and UrlSchemas in Info.plist.

Thank you!

Best Answer

Answers

  • pauldanut94pauldanut94 Member ✭✭

    Thanks for your time, @LandLu . Your approach helped me a lot. I owe you!

Sign In or Register to comment.