mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-10-09 01:25:14 +08:00
Rename file_paths.xml to avoid overwrite
This commit is contained in:
@@ -489,6 +489,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
|
||||
if (UpdateContext.DEBUG) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.e("pushy", "download task failed", e);
|
||||
params[0].listener.onDownloadFailed(e);
|
||||
}
|
||||
return null;
|
||||
|
@@ -116,17 +116,18 @@ public class UpdateModule extends ReactContextBaseJavaModule{
|
||||
}
|
||||
|
||||
public static void installApk(File toInstall) {
|
||||
Uri apkUri;
|
||||
Intent intent;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
Uri apkUri = getUriForFile(mContext, mContext.getPackageName() + ".pushy.fileprovider", toInstall);
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
|
||||
apkUri = getUriForFile(mContext, mContext.getPackageName() + ".pushy.fileprovider", toInstall);
|
||||
intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
|
||||
intent.setData(apkUri);
|
||||
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(intent);
|
||||
} else {
|
||||
Uri apkUri = Uri.fromFile(toInstall);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
apkUri = Uri.fromFile(toInstall);
|
||||
intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setDataAndType(apkUri, "application/vnd.android.package-archive");
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(intent);
|
||||
|
Reference in New Issue
Block a user