I downloaded the sample Сamera2 API code to my device. In another app, I want to launch a third-party camera, but I can't select the one I downloaded.
I downloaded the sample Сamera2 API code to my device. In another app, I want to launch a third-party camera, but I can't select the one I downloaded.
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.
Hello, thanx for the answer, but i resolved my problem with another solution. I added above my CameraActivity page right near that Manifest String [Activity (Label = "Camera2Basic", MainLauncher = true, Icon = "@drawable/icon")]
my Intent Filter which contains this code
[IntentFilter(new[] { "android.media.action.IMAGE_CAPTURE" }, Categories = new[] { Intent.CategoryDefault})]
7 people are following this question.