0

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?

airbourne
  • 119
  • 1
  • 3
  • 11

1 Answers1

1

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?

Community
  • 1
  • 1
cw fei
  • 1,534
  • 1
  • 15
  • 33