Skip to content

Commit

Permalink
Rename file_paths.xml to avoid overwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnylqm committed Nov 3, 2020
1 parent ec8c475 commit e3081a0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ protected Void doInBackground(DownloadTaskParams... params) {
if (UpdateContext.DEBUG) {
e.printStackTrace();
}
Log.e("pushy", "download task failed", e);
params[0].listener.onDownloadFailed(e);
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,18 @@ public static void installApk(String url) {
}

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);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<files-path name="." path="."/>
<files-path
name="pushy"
path="." />
</paths>

0 comments on commit e3081a0

Please sign in to comment.