安装指定apk
由于Android N对Intent携带 file:///类型Uri的限制,所以需要适配Android N,需要使用Provider来实现安装
需要在manifest文件中加入
<provider>
android:name="android.support.v4.content.FileProvider"
android:authorities="com.sunvua.android.atlas"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_path" />
</provider\>
创建 file_paht.xml,内容为
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<paths>
<external-path path="" name="download"/>
</paths>
</resources>
其余Android N 注意事项查看源码