Friday, September 25, 2009

Installing packages in Android

I've been playing around with Android quite a bit lately. One really cool thing is you can write a package (package == application) that can install other applications. Obviously this isn't done silently. A UI will be presented to the user asking them if they want to install this package and info about it.

Its basically done by sending an intent.

Intent intent = new Intent(Intent.VIEW);
intent.setDataAndType(Uri.parse("The url to your package"), "application/
vnd.android.package-archive");
startActivity(intent);

And there you go. Obviously of you want to to be notified when its complete you can also do a startActivityWithResponse call. I see this as being very powerful.

No comments: