mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-10-31 13:23:12 +08:00 
			
		
		
		
	Rename file_paths.xml to avoid overwrite
This commit is contained in:
		| @@ -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> | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -1,3 +1,5 @@ | ||||
| <paths xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|     <files-path name="." path="."/> | ||||
|     <files-path | ||||
|         name="pushy" | ||||
|         path="." /> | ||||
| </paths> | ||||
		Reference in New Issue
	
	Block a user
	 sunnylqm
					sunnylqm