Skip to content

Commit

Permalink
Compat install logic by feedback for galaxy s7 on 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yjfnypeu committed May 25, 2018
1 parent 7d5704f commit ee1467e
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,16 @@ public void install(Context context, String filename, final Update update) {
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(Intent.ACTION_VIEW);
String type = "application/vnd.android.package-archive";
File pluginFile = new File(filename);
File apkFile = new File(filename);
Uri uri;
if (Build.VERSION.SDK_INT >= 24) {
// Adaptive with api version 24+
uri = UpdateInstallProvider.getUriByFile(pluginFile, getAuthor(context));
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
uri = UpdateInstallProvider.getUriByFile(apkFile, getAuthor(context));
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION|Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
} else {
uri = Uri.fromFile(pluginFile);
uri = Uri.fromFile(apkFile);
}
intent.setDataAndType(uri, type);
intent.setDataAndType(uri, "application/vnd.android.package-archive");
context.startActivity(intent);

}
Expand Down

0 comments on commit ee1467e

Please sign in to comment.