I install apk file from folder programatically in such way:
File file = new File(apkFilePath);
if (file.exists()) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("file://" + apkFilePath),
"application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
} catch (Exception e) {
Log.d(TAG, "install error: " + e.toString());
}
} else {
Log.d(TAG, "File doesn't exist ");
}
When dialog appear there are two buttons "Install" and "Cancel". I need to catch cancel event. I try to register broadcast receiver but can't find appropriate event for cancel install action.