Skip to content

Commit e3081a0

Browse files
committed
Rename file_paths.xml to avoid overwrite
1 parent ec8c475 commit e3081a0

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

android/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
android:grantUriPermissions="true">
1212
<meta-data
1313
android:name="android.support.FILE_PROVIDER_PATHS"
14-
android:resource="@xml/file_paths" />
14+
android:resource="@xml/pushy_file_paths" />
1515
</provider>
1616
</application>
1717
</manifest>

android/src/main/java/cn/reactnative/modules/update/DownloadTask.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ protected Void doInBackground(DownloadTaskParams... params) {
489489
if (UpdateContext.DEBUG) {
490490
e.printStackTrace();
491491
}
492+
Log.e("pushy", "download task failed", e);
492493
params[0].listener.onDownloadFailed(e);
493494
}
494495
return null;

android/src/main/java/cn/reactnative/modules/update/UpdateModule.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,18 @@ public static void installApk(String url) {
116116
}
117117

118118
public static void installApk(File toInstall) {
119+
Uri apkUri;
120+
Intent intent;
119121
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
120-
Uri apkUri = getUriForFile(mContext, mContext.getPackageName() + ".pushy.fileprovider", toInstall);
121-
122-
Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
122+
apkUri = getUriForFile(mContext, mContext.getPackageName() + ".pushy.fileprovider", toInstall);
123+
intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
123124
intent.setData(apkUri);
124125
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
125126
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
126127
mContext.startActivity(intent);
127128
} else {
128-
Uri apkUri = Uri.fromFile(toInstall);
129-
Intent intent = new Intent(Intent.ACTION_VIEW);
129+
apkUri = Uri.fromFile(toInstall);
130+
intent = new Intent(Intent.ACTION_VIEW);
130131
intent.setDataAndType(apkUri, "application/vnd.android.package-archive");
131132
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
132133
mContext.startActivity(intent);
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
<paths xmlns:android="http://schemas.android.com/apk/res/android">
2-
<files-path name="." path="."/>
2+
<files-path
3+
name="pushy"
4+
path="." />
35
</paths>

0 commit comments

Comments
 (0)