installApk method

  1. @override
Future<InstallResult> installApk(
  1. String filePath
)
override

直接安装APK文件

filePath APK文件的完整路径

Implementation

@override
Future<InstallResult> installApk(String filePath) async {
  try {
    final result = await methodChannel.invokeMethod<String>('installApk', {
      'filePath': filePath,
    });
    return InstallResult(_parseInstallStatus(result));
  } on PlatformException catch (e) {
    debugPrint('安装APK失败: ${e.message}');
    return InstallResult(InstallStatus.failed, message: e.message);
  }
}