Skip to content
This repository has been archived by the owner on Jan 16, 2019. It is now read-only.

Commit

Permalink
fixed updater on Android 7+
Browse files Browse the repository at this point in the history
  • Loading branch information
ov3rk1ll committed Feb 9, 2017
1 parent da99ab6 commit 293f414
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repositories {

def versionMajor = 1
def versionMinor = 6
def versionPatch = 0
def versionPatch = 1
def versionBuild = 99 // bump for dogfood builds, public betas, etc.
ext {
calculateVersionName = {
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@
</activity>

<meta-data android:name="io.fabric.ApiKey" android:value="${FABRIC_API_KEY}" />

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

</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.os.AsyncTask;
import android.os.PowerManager;
import android.preference.PreferenceManager;
import android.support.v4.content.FileProvider;
import android.util.Log;
import android.widget.Toast;

Expand Down Expand Up @@ -485,7 +486,11 @@ protected void onPostExecute(String result) {

//Open file
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(localFile), "application/vnd.android.package-archive");
Uri uri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", localFile);
Log.i(TAG, "onPostExecute: open " + uri);
// Uri.fromFile(localFile)
intent.setDataAndType(uri, "application/vnd.android.package-archive");
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
context.startActivity(intent);
}
}
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/xml/provider_paths.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path name="external_files" path="."/>
</paths>

0 comments on commit 293f414

Please sign in to comment.