{"id":25257906,"url":"https://github.com/alexcmgit/device-packages","last_synced_at":"2025-06-20T03:32:15.986Z","repository":{"id":109371756,"uuid":"602799945","full_name":"alexcmgit/device-packages","owner":"alexcmgit","description":"Flutter plugin to get the list of installed applications on Android.","archived":false,"fork":false,"pushed_at":"2023-09-30T14:42:38.000Z","size":96,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T14:22:05.815Z","etag":null,"topics":["android","apk","apps","broadcast","device","flutter","list","packages","plugin"],"latest_commit_sha":null,"homepage":"https://github.com/alexrintt/device-packages","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexcmgit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-17T00:52:11.000Z","updated_at":"2024-10-02T12:39:32.000Z","dependencies_parsed_at":"2023-03-07T22:45:36.531Z","dependency_job_id":"feb6093b-2dd3-4654-ba51-61fd19df8812","html_url":"https://github.com/alexcmgit/device-packages","commit_stats":null,"previous_names":["alexcmgit/device-packages"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexcmgit%2Fdevice-packages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexcmgit%2Fdevice-packages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexcmgit%2Fdevice-packages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexcmgit%2Fdevice-packages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexcmgit","download_url":"https://codeload.github.com/alexcmgit/device-packages/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419870,"owners_count":20936013,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","apk","apps","broadcast","device","flutter","list","packages","plugin"],"created_at":"2025-02-12T06:52:47.016Z","updated_at":"2025-04-06T01:14:14.557Z","avatar_url":"https://github.com/alexcmgit.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e **Warning** this is a WIP.\n\n# Device Packages plugin for Flutter\n\n![Plugin badge version](https://img.shields.io/pub/v/device_packages.svg?style=for-the-badge\u0026color=22272E\u0026showLabel=false\u0026labelColor=15191f\u0026logo=dart\u0026logoColor=blue)\n\nA plugin to list installed applications on an Android device (iOS is not supported). You can also listen to app changes (install, uninstall and update).\n\n## Getting Started\n\nCheck the latest version on [pub.dev](https://pub.dev/packages/device_packages).\n\n```yaml\ndependencies:\n  device_packages: \u003clatest-version\u003e\n```\n\nImport:\n\n```dart\nimport 'package:device_packages/device_packages.dart';\n```\n\n## Android permissions\n\nSince Android 11 (API level 30), most user-installed apps are not visible by default. In your manifest, you must statically declare which apps you are going to get info about, as in the following:\n\n```xml\n\u003cmanifest\u003e\n  \u003cqueries\u003e\n    \u003c!-- Explicit apps you know in advance about: --\u003e\n    \u003cpackage android:name=\"com.example.this.app\"/\u003e\n    \u003cpackage android:name=\"com.example.this.other.app\"/\u003e\n  \u003c/queries\u003e\n  ...\n\u003c/manifest\u003e\n```\n\n- Reference https://stackoverflow.com/questions/18752202/check-if-application-is-installed-android.\n\n---\n\nYou also must include these permissions:\n\n```xml\n\u003c!-- To request install an apk --\u003e\n\u003cuses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\" /\u003e\n\n\u003c!-- To request uninstall a package --\u003e\n\u003cuses-permission android:name=\"android.permission.REQUEST_DELETE_PACKAGES\" /\u003e\n\n\u003c!-- To get all installed apps --\u003e\n\u003cuses-permission android:name=\"android.permission.QUERY_ALL_PACKAGES\" /\u003e\n```\n\n## List installed packages\n\nTo list installed packages on the device:\n\n```dart\n// Recommended if you are displaying the apps in list view.\n// You can use the stream to lazy-load and improve the UI/UX.\nStream\u003cPackageInfo\u003e packagesStream = await DevicePackages.getInstalledPackagesAsStream();\n\n// Recommended if you are performing a background task \n// and don't mind taking several seconds to load all pakckages.\nList\u003cPackageInfo\u003e packages = await DevicePackages.getInstalledPackages();\n```\n\nYou can filter system apps if necessary.\n\n**Note**: The list of apps is not ordered! You have to do it yourself.\n\n### Get openable packages\n\nOn android, an openable package means you can launch the application.\n\nTo list only the apps with launch intents, simply use the `onlyOpenablePackages: true` attribute.\n\n```dart\n// Returns a list of only those apps that have launch intent (for Android)\n// This is also available for [getInstalledPackages].\nStream\u003cPackageInfo\u003e packagesStream = DevicePackages.getInstalledPackagesAsStream(\n  onlyOpenablePackages: true, \n  includeSystemApps: true\n)\n```\n\n## Get a package\n\nTo get a specific application info, provide its package id:\n\n```dart\nPackageInfo package = await DevicePackages.getPackage('io.alexrintt.kanade');\n```\n\n## Check if an application is installed\n\nTo check if an app is installed (via its package id):\n\n```dart\nbool isInstalled = await DevicePackages.isPackageInstalled('io.alexrintt.kanade');\n```\n\n## Open a package\n\nTo open a package (on Android the package must have a launch Intent).\n\n```dart\nDevicePackages.openPackage('io.alexrintt.kanade');\n```\n\n## Open a package settings screen\n\nTo open package settings:\n\n```dart\nDevicePackages.openPackageSettings('io.alexrintt.kanade');\n```\n\n## Uninstall package\n\nTo open the screen to uninstall a package:\n\n1. Add this permission to the `AndroidManifest.xml` file:\n\n```xml\n\u003c!-- Remember to add the permission --\u003e\n\u003cuses-permission android:name=\"android.permission.REQUEST_DELETE_PACKAGES\" /\u003e\n```\n\n2. Call this method:\n\n```dart\nDevicePackages.uninstallPackage('io.alexrintt.kanade');\n```\n\n## Install package\n\nTo open the screen to install a package:\n\n1. Add this permission to the `AndroidManifest.xml` file:\n\n```xml\n\u003c!-- Remember to add the permission --\u003e\n\u003cuses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\" /\u003e\n```\n\n2. Call this method:\n\n```dart\n// Android: If you are working with SAF (or URIs in general).\nDevicePackages.installPackage(installerUri: Uri.parse('...'));\n\n// Android: If you are working with old SDKs or managing your files by MANAGE_EXTERNAL_STORAGE (or File APIs in general).\nDevicePackages.installPackage(installerPath: '/storage/emulated/0/Downloads/app.apk');\nDevicePackages.installPackage(installerFile: File('/storage/emulated/0/Downloads/app.apk'));\n```\n\n## Include package icon\n\nWhen calling `getInstalledPackages()` or `getPackage()` methods, you can also ask for the icon.\nTo display the image, just call:\n\n```dart\nImage.memory(app.icon);\n```\n\n## Listen to package events\n\nTo listen to package events on the device (installation, uninstallation, update):\n\n```dart\nStream\u003cApplicationEvent\u003e apps = await DevicePackages.listenToAppsChanges();\n```\n\nIf you only need events for a single app, just use the `Stream` API, like so:\n\n```dart\nDevicePackages.listenToPackageEvents().where(\n  (PackageEvent event) =\u003e event.packageId == 'io.alexrintt.kanade'\n)\n```\n\nTo get package details from the event, use the `DevicePackages.getPackage` API:\n\n```dart\nDevicePackages.listenToPackageEvents().liste(\n  (PackageEvent event) async {\n    if (!await DevicePackages.isPackageInstalled(event.packageId)) {\n      // You do not have access to package info since\n      // the package was uninstalled.\n      // Although you can retrive from your cache (if any).\n    } else {\n      final PackageInfo package = \n          await DevicePackages.getPackage(event.packageId);\n\n      print('Action: ${event.action}');\n      print('Package name: ${package.name}');\n      print('Package id: ${package.id}');\n      print('Is system package: ${package.isSystemPackage}');\n\n      // Apk file path on Android.\n      print('Package installerPath: ${package.installerPath}');\n    }\n  },\n)\n```\n\n## Footnotes\n\nThis plugin was initially a fork of `device_apps` https://github.com/g123k/flutter_plugin_device_apps, but since the plugin author is no longer maintaining the project (resolving issues or merging pull requests) I did decide to create this plugin, make some improvements and add some features:\n\n- [x] Java to Kotlin fully migration.\n- [x] List installed apps in lazy-load mode https://github.com/g123k/flutter_plugin_device_apps/pull/90.\n- [x] Install packages, on Android this means being able to start a new activity to install an apk file/uri.\n- [x] Fixed unresolved bug on `listenToPackageEvents` https://github.com/g123k/flutter_plugin_device_apps/issues/97.\n- [ ] Support for getting the current Android launcher package https://github.com/g123k/flutter_plugin_device_apps/pull/82.\n- [ ] Getting package info from intaller file/uri, on Android this means generating the `PackageInfo` from an apk file https://github.com/g123k/flutter_plugin_device_apps/pull/92.\n- [ ] Sign-in apk files https://stackoverflow.com/questions/10630796/signing-apk-files-programmatically-in-java.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexcmgit%2Fdevice-packages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexcmgit%2Fdevice-packages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexcmgit%2Fdevice-packages/lists"}