installAPK static method
Install APK silently without granting permission.
file
APK file.
Implementation
static Future<bool?> installAPK({required File file}) async {
if (Platform.isAndroid) {
try {
final bool? isInstalled = await _channel.invokeMethod(
_METHOD_INSTALL_APK, <String, String>{'filePath': file.path});
return isInstalled;
} on PlatformException catch (e) {
throw "Installation Error Occurred: Code: ${e.code}. Message: ${e.message}. Details: ${e.details}";
}
} else {
// Return false if not Android.
return false;
}
}