Flutter Install APK Silently

pub.dev Donate Paypal Buy Me A Coffee GitHub Follow

Explain

This plugin is used when you need to install APKs on Android without any UI interruption and silently on Custom Android ROM using rooted devices.

Getting Started

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_install_apk_silently: ^0.2.0

Android

You need to add some permission in AndroidManifest.xml file.

<!-- Install/delete permissions, only granted to system apps -->
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.DELETE_PACKAGES" />

Android Root on Emulator

You must have to root your device. To test the package on Emulator, you can follow these instructions here. Or you can root you real device and make your Custom Rom.

Usage

Install APK

You just have to import the package with

import 'package:flutter_install_apk_silently/flutter_install_apk_silently.dart';

Then you can download APK from internet or use one from device storage as file, and pass it to install.

Please see example.

bool result = await FlutterInstallApkSilently.installAPK(file: file);

The method will return a boolean with the status of installation. And if it fails you can catch the error.

Reboot Device

This method helps to reboot your device, you should check your permissions in manifest.

bool result = await FlutterInstallApkSilently.rebootDevice();

This plugin is mainly developed for GRANDTK company.

Issues or Contributions

This is a beta version of plugin, so I am very appreciated for any issues or contribution you can help me with.

License

MIT: https://mit-license.org.

Copyright (c) 2019 Shady Boshra. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Find me on StackOverflow

profile for Shady Boshra at Stack Overflow, Q&A for professional and enthusiast programmers