List of all apps installed by user xamarin android

kevin david 161 Reputation points
2022-03-16T16:43:58.817+00:00

I am using the following code, and it brings me some apps installed but not all, I want to know if chrome is installed but it does not give me any results even though I do have chrome installed. How can I solve that?

var apps = Android.App.Application.Context.PackageManager.GetInstalledApplications(PackageInfoFlags.MatchAll);
foreach (var app in apps)
{
      string packageName = (app.LoadLabel(Android.App.Application.Context.PackageManager)).ToString();
      string browser = "chrome";
      if (packageName.ToLower().Contains(browser))
      {
           foundBrowser = true;
           break;
       }

}

Developer technologies .NET Xamarin
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2022-03-17T01:57:01.227+00:00

    Hello,​

    Firstly, It is not recommended to query all of installed application, Google is restricting which apps can see the other installed apps on your device. you can limit to query it.

    Please add following QUERY_ALL_PACKAGES permission in your AndroidManifest.xml. It is a normal permission and it is granted as soon as the app is installed.

       <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />  
    

    Please note: Google outlines permitted uses of the QUERY_ALL_PACKAGES permission as follows:

    Permitted use involves apps that must discover any and all installed apps on the device, for awareness or interoperability purposes may have eligibility for the permission. Permitted use >includes; device search, antivirus apps, file managers, and browsers.

    If your app meets the permitted application for the acceptable use of the QUERY_ALL_PACKAGES permission, you will be required to declare this and any other high-risk permissions using the Permissions Declaration Form in Play Console.

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.