1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

Rename file_paths.xml to avoid overwrite

This commit is contained in:
sunnylqm 2020-11-03 15:52:59 +08:00
parent ec8c475c54
commit e3081a02db
4 changed files with 11 additions and 7 deletions

View File

@ -11,7 +11,7 @@
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
android:resource="@xml/pushy_file_paths" />
</provider>
</application>
</manifest>

View File

@ -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;

View File

@ -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);

View File

@ -1,3 +1,5 @@
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<files-path name="." path="."/>
<files-path
name="pushy"
path="." />
</paths>