Reputation: 119
I want to update an apk through code. However I need to establish a mechanism that checks when that application has updated. I need to somehow get a message back from the intent
Context ctx = getApplicationCOntext();
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File("/mnt/sdcard/Download/update.apk")), "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(intent);
This is the default mechanism to install an application. How can I check that if the intent has finished?
Upvotes: 0
Views: 1883
Reputation: 1564
Use startActivityForResult()
if you want data to be return from the called activity.
For more details, read:
Getting a Result from an Activity
How to manage startActivityForResult
on Android?
Upvotes: 1