tags:

views:

31

answers:

1

I have an application that I'd like to add auto-update functionality (its not in the marketplace). I have all the code in place that would check to see if there is an update available and then i call something like this:

Intent intent = new Intent(Intent.ACTION_VIEW ,Uri.parse(Configuration.APK_URL)); c.startActivity(intent);

which starts downloading the file, although is there a way that I can programatically tell it to "open" the file to begin the installation process without the user having to go to the downloads and clicking on it?

+2  A: 

This will start the installation process

File apkFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/packageName.apk");
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive");
startActivity(intent);
Travis