Using url scheme to launch app, how to specify starting activity?

aluzi liu 366 Reputation points
2022-04-07T09:52:39.383+00:00

My app using AppShell, I have two TabBar in AppShell.xaml, one is LoginPage, another is MainPage. If login success, I will goto MainPage using this:

Shell.Current.GoToAsync("//Main", false);

My problem is, If launch app in browser using url scheme, each time the app launch, it will display the LoginPage even though I have logon to MainPage.
How to make the app keep MainPage when launch from url scheme?


I add this code to AndroidManifest.xml:

<application android:label="Label A">
  <activity android:icon="@drawable/Icon" android:label="LabelB" android:name=".MainActivity">
    <intent-filter>
      <action android:name="android.intent.action.VIEW" />
      <category android:name="android.intent.category.DEFAULT" />
      <category android:name="android.intent.category.BROWSABLE" />
      <data android:scheme="myapp" />
    </intent-filter>
  </activity>
</application>

And in html page, I using this code to launch app:

<a href="myapp://test.com/?name=xxx">Open App test</a>
Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,012 questions
{count} votes