I am new to Android and I have an application which consists in a service and on some point the service needs to install a new .apk (basically an auto-update), currently the installation is done like in the code bellow which does not allow to know when it finishes or get a result out of it and I need to know that in order to perform other actions driven on that result.
File mFile = new File(Uri.parse(downloadedPackageUriString).getPath());
Intent promptInstall = new Intent(Intent.ACTION_VIEW)
.setDataAndType(Uri.fromFile(mFile), "application/vnd.android.package-archive")
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
appContext.startActivity(promptInstall);
I would like to know if there is a way of doing that? Thank you in advance.