Provider
This commit is contained in:
parent
60760914f6
commit
282da3e706
@ -10,8 +10,8 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
<provider
|
<provider
|
||||||
android:name="android.support.v4.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
android:authorities="${applicationId}.fileprovider"
|
android:authorities=".J_FileProvider"
|
||||||
android:grantUriPermissions="true"
|
android:grantUriPermissions="true"
|
||||||
android:exported="false">
|
android:exported="false">
|
||||||
<!-- 元数据 -->
|
<!-- 元数据 -->
|
||||||
|
@ -8,7 +8,6 @@ import android.content.SharedPreferences;
|
|||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import androidx.core.content.FileProvider;
|
import androidx.core.content.FileProvider;
|
||||||
|
|
||||||
@ -39,9 +38,8 @@ public class DownLoadBroadcastReceiver extends BroadcastReceiver {
|
|||||||
}
|
}
|
||||||
if(filePath == null) return;
|
if(filePath == null) return;
|
||||||
File file = new File(filePath);
|
File file = new File(filePath);
|
||||||
Log.e("PATH", String.valueOf(Uri.fromFile(file)));
|
|
||||||
if (Build.VERSION.SDK_INT >= 24) {
|
if (Build.VERSION.SDK_INT >= 24) {
|
||||||
Uri apkUri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + "" + ".fileprovider", file);
|
Uri apkUri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID.concat(".J_FileProvider"), file);
|
||||||
install.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
install.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
install.setDataAndType(apkUri, "application/vnd.android.package-archive");
|
install.setDataAndType(apkUri, "application/vnd.android.package-archive");
|
||||||
} else {
|
} else {
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
package top.jerryyan.RN.A.VersionUpgrade;
|
||||||
|
|
||||||
|
import androidx.core.content.FileProvider;
|
||||||
|
|
||||||
|
public class J_FileProvider extends FileProvider {
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user