I'm creating application custom updater, got Parse error while updating.
I download signed apk using AsyncTask
output = new FileOutputStream(context.getFilesDir()+"/update.apk");
Download completes succesfully, then I try to run apk like this:
File file = new File("file://"+context.getFilesDir(), "update.apk");
file.setReadable(true, false);
Intent promptInstall = new Intent(Intent.ACTION_VIEW)
.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
promptInstall.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
promptInstall.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(promptInstall);
App starts to update, but then gomes my issue,
Parse Error: An error occurred while parsing the package
What am I doing wrong?