Hello,
Welcome to our Microsoft Q&A platform!
You can try the following code, it works on my side:
string packageName = "Camera2Basic.Camera2Basic";
button.Click += delegate {
try
{
PackageManager pm = Android.App.Application.Context.PackageManager;
if (IsAppInstalled(packageName))
{
Intent intent = pm.GetLaunchIntentForPackage(packageName);
if (intent != null)
{
intent.SetFlags(ActivityFlags.NewTask);
Android.App.Application.Context.StartActivity(intent);
}
}
else
{
Intent intent = pm.GetLaunchIntentForPackage("Camera2Basic.Camera2Basic");
if (intent != null)
{
intent.SetFlags(ActivityFlags.NewTask);
Android.App.Application.Context.StartActivity(intent);
}
}
}
catch (ActivityNotFoundException)
{
}
};
Best Regards,
Jessie Zhang
---
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.