I am very new to Mobile development. I am using MAUI for it. I wanted to launch my app from browser on some event. I have the below activity configured in AndriodManifest.xaml.
<activity android:label="Tranact Trip Tracker" android:name="com.companyname.tranacttriptracker.mainactivity" android:exported="true">
<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="urlschemetest"
android:host="testurl"/>
</intent-filter>
</activity>
On my MainActivity.cs, i have the below code.
protected override void OnCreate(Bundle bundle)
{
Intent intent = this.Intent;
var action = intent.Action;
var strLink = intent.DataString;
if (Intent.ActionView == action && !string.IsNullOrWhiteSpace(strLink))
{
Toast.MakeText(this, strLink, ToastLength.Short).Show();
Shell.Current.GoToAsync(nameof(TranactTripPage));
}
if (!String.IsNullOrEmpty(Intent.GetStringExtra(Intent.ExtraText)))
{
string subject = Intent.GetStringExtra(Android.Content.Intent.ExtraSubject) ?? "subject not available";
Toast.MakeText(this, subject, ToastLength.Long).Show();
}
base.OnCreate(bundle);
}
I have the anchor tag which has href as "urlschemetest://testurl". When i click the link, it takes me to MainActivity but in Oncreate method it throw below error.
Android.Views.InflateException Message=Binary XML file line #1: Binary XML file line #1: Error inflating class <unknown>
I wanted user to navigate to different view with some information. but it throws the error.
How to show different view?