Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MZCretin committed Mar 22, 2017
1 parent 55820e9 commit 6f588c1
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.cretin.www.autoupdateproject">

<uses-permission android:name="android.permission.INTERNET"/>
Expand All @@ -22,6 +23,17 @@
</activity>

<service android:name="com.cretin.www.cretinautoupdatelibrary.utils.DownloadService"/>

<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:grantUriPermissions="true"
android:exported="false"
>
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/install_file" />
</provider>
</application>

</manifest>
4 changes: 4 additions & 0 deletions app/src/main/res/xml/file_paths.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="."/>
</paths>
File renamed without changes.
11 changes: 1 addition & 10 deletions cretinautoupdatelibrary/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,7 @@
android:label="@string/app_name"
android:supportsRtl="true"
>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.cretin.www.cretinautoupdatelibrary.fileprovider"
android:grantUriPermissions="true"
android:exported="false"
>
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/install_file" />
</provider>

</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ public static void installApkFile(Context context, File file) {
Intent intent = new Intent(Intent.ACTION_VIEW);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri contentUri = FileProvider.getUriForFile(context, "com.cretin.www.cretinautoupdatelibrary.fileprovider", file);
Uri contentUri = FileProvider.getUriForFile(context, context.getPackageName()+".fileprovider", file);
intent.setDataAndType(contentUri, "application/vnd.android.package-archive");
} else {
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
Expand Down

0 comments on commit 6f588c1

Please sign in to comment.