capacitor-apps-list
v0.2.0
Published
Capacitor plugin that provides list of installed apps on an Android device
Maintainers
Readme
capacitor-apps-list
Capacitor plugin that provides list of installed apps on an Android device
Each app constains the name, package name, category number and base64 encoded png icon.
Install
npm install capacitor-apps-list
npx cap syncNext click Android studio -> Sync project with gradle files.
Usage
Basic
Import the plugin in your service and call the method getAppsList().
import { AppsList, AppsListPlugin } from 'capacitor-apps-list';
@Injectable({
providedIn: 'root',
})
export class AppsWhitelistService {
getAppsList(): Promise<AndroidAppsDto> {
return this.appsListPlugin.getAppsList();
}
}You will receive a list of installed apps on the device.
export interface AndroidApp {
appName: string;
packageName: string;
category: AndroidAppCategory;
base64Icon: string;
}You can also get details of specific apps by their package names using the method getAppsDetails().
getAppsDetails(packageNames: string[]): Promise<AndroidAppsDto>Note that you will receive null at the index of a package name that is no longer installed
Displaying the icon
To display the icon in your application, you can use the following code:
<img [src]="'data:image/png;base64,' + app.base64Icon" alt="app icon" />Where app is an object of type AndroidApp.
Important
This plugin uses the following permissions in your AndroidManifest.xml:
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />This is a special permission that requires approval from Google Play Store and it is only allowed for specific use-cases. Read more here: https://support.google.com/googleplay/android-developer/answer/10158779
API
Capacitor plugin for listing installed apps on Android devices.
getAppsList()
getAppsList() => Promise<AndroidAppsDto>Get a list of all installed apps on the device. Excludes system apps that were not updated using the Play Store.
Returns: Promise<AndroidAppsDto>
getPackagesNamesDetails(...)
getPackagesNamesDetails(options: { packagesNames: string[]; }) => Promise<AndroidAppsDtoNullable>Get details of specific apps by their package names.
| Param | Type |
| ------------- | ----------------------------------------- |
| options | { packagesNames: string[]; } |
Returns: Promise<AndroidAppsDtoNullable>
Interfaces
AndroidAppsDto
| Prop | Type |
| ----------------- | ------------------------- |
| androidApps | AndroidApp[] |
AndroidApp
| Prop | Type |
| ----------------- | ----------------------------------------------------------------- |
| appName | string |
| packageName | string |
| category | AndroidAppCategory |
| base64Icon | string |
AndroidAppsDtoNullable
| Prop | Type |
| ----------------- | ------------------------------------------------------------- |
| androidApps | (AndroidApp | null)[] |
Enums
AndroidAppCategory
| Members | Value |
| ------------------- | --------------- |
| Undefined | -1 |
| Game | |
| Audio | |
| Video | |
| Image | |
| Social | |
| News | |
| Maps | |
| Productivity | |
| Accessibility | |
