I update my app using a local downloaded .apk
, via DownloadManager
, using this code:
val installIntent = Intent(Intent.ACTION_VIEW)
installIntent.setDataAndType(localUri, "application/vnd.android.package-archive")
installIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
this.startActivity(installIntent)
Although most of the time it works, sometimes, only some of the users get the "There was a problem parsing the package error"
popup.
I'm interested if there is any callback that we can get in our app, whenever this happens, or user press 'OK' in the popoup . I found here for instance, a callback that checks if the package exists (meaning that it was installed) but I'm more interested for updates, in this case I already know that the app was previously installed.
Is there a callback (maybe startActivityForResults
) for this specific intent, so we know that it was successfully installed or it failed?