APK Admin Plugin for Flutter

A Flutter plugin for launching, installing from backup, uninstalling and sharing android apps and more!.

Pub

getting started

add apk_admin as a dependency in your pubspec.yaml file.

dependencies:
  flutter:
    sdk: flutter
  apk_admin: 2.2.4

Next, import 'apk_admin.dart'

import 'package:apk_admin/apk_admin.dart';

list of installed applications

To get a list of all apps installed on the device:

// App is a custom class created by the plugin and it contains
// packageName, versionName, decodedIcon, installDate and lastUpdateDate.
// this method takes three parameters:
// bool includeSystemApps => default value is false
// bool onlyIncludeAppsWithLaunchIntent => default value is true
// bool includeAppIcon => default value is false
// To show the app icon set includeAppIcon to true and use Image.network(decodedIcon).

ApkScouter apkScouter = ApkScouter();
List<App> apps = await apkScouter.getInstalledApps();

launch app

// Result retrieved from this method call tells you where the app was launched.

ApkController apkController = ApkController();
String launchResult = await apkController.launchApp("packageName");

uninstall app

ApkController apkController = ApkController();
await apkController.uninstallApp("packageName");

make backup

To make an apk backup of an app by its packageName:

// if the WRITE_EXTERNAL_PERMISSION is not granted
// the method will ask the user for his permission automatically.
// Result retrieved from this method call tells you whether the backup process
// completed successfully, failed or the WRITE_EXTERNAL_PERMISSION is required
// and method should be called again after the permission is granted. 

ApkBackup apkBackup = ApkBackup();
String backupResult = await apkBackup.backupApp("packageName");

get backups

To get a list of all stored backups on the device:

// All backups gets stored in your app file directory
// under a sub directory called "backups"
// for example if your app package name is com.example.name them backups will be
// stored under /storage/emulated/0/Android/data/com.example.name/files/backups .

ApkScouter apkScouter = ApkScouter();
Map<String, String> backups = await apkScouter.getBackups();

restore app from backup

// You can get apkPath from the map retrieved by calling getBackups method.

ApkBackup apkBackup = ApkBackup();
await apkAdmin.restoreAppFromBackup("apkPath");

share app via bluetooth

ApkExporter apkExporter = ApkExporter();
await apkExporter.shareAppViaBluetooth("packageName");
ApkExporter apkExporter = ApkExporter();
await apkExporter.shareAppLink("packageName");

showcase

Installed Apps Backups

example

for a complete example please refer to this link

issues

If you found any bug please file a new issue here.