Skip to content

nsNeruno/android_package_manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

android_package_manager Pub

Provides access to Android's native PackageManager API to fetch various information, such as installed applications, packages, permissions, etc.

About this Package

This plugin is purposed for Android use only. Allowing easier access to most commonly used methods of Android's PackageManager API. Adapted a few methods from existing package package_manager which seems not to be maintained recently.

Getting Started

Importing:

import package:android_package_manager/android_package_manager.dart;

Singleton access example:

final pm = AndroidPackageManager();

Available Methods

Please see official documentation of PackageManager API.
Disclaimer: I have been trying to adapt most of the available methods. Done with some simple instrumentation tests.
Tested methods can be found under example/integration_test directory.

Example Flutter app demonstrates the getInstalledPackages method.

Side Notes

Please take note of the flags optional argument on some of the methods. These will affect the output of the request to the APIs. For example, PackageInfo won't show any permissions info if the flag for GET_PERMISSIONS is not specified.

Optional permissions

By default, the list of installed apps is limited on Android 11 (API level 30) and higher. Read more about it here. To access the full list of apps installed on a device, add the following permission to your AndroidManifest.xml file:

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

TO-DOs

  • Proper documentation
  • DartDocs
  • Adjusting some methods to be Android Tiramisu compatible (deprecating some methods)
  • Documenting bitmask values
  • Separating interfaces into a separate package (maybe)

Issues

Feel free to file issues or any suggestions here