Android APP更新实践 - 完美解决9.0前的各种版本.md
Android 内部更新实践 完美解决各个版本
3. 安装新版本的APP
1. 创建工具类文件 InstallUtil.java
文件内容链接 https://blog.****.net/bencheng06/article/details/82887948
2. 注册应用安装FileProvider
<!-- 注册应用安装FileProvider -->
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="这里填写自己的包名.FileProvider"
android:exported="false"
android:grantUriPermissions="true">
<!-- 元数据 -->
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
3. 注册安装权限,忘记注册会报错
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
4. 在使用的地方调用一下
new InstallUtil((Activity) context, appPath).install();