views:

308

answers:

1

Android 2.1 (not sure how much that matters) My test hardware is a Motorola Droid (not sure how much that matters either)

I want to push a bookmark/internet-shortcut to a user's home screen as a result of them clicking on a link - via their browser of choice.

I know they can usually set the bookmark themselves and then choose to put it on their home screen. But I'd like to provide a link like "Put a shortcut to this page on your home screen" that takes care of everything kind of in the background/underneath.

Is this even possible? What parts of the framework would I need access to to make it happen?

+3  A: 

Yes you can. First of all, you need to request the permission "com.android.launcher.permission.INSTALL_SHORTCUT". Then, broadcast an Intent with the action "com.android.launcher.action.INSTALL_SHORTCUT" and add the following extra: - Type = Intent - Name = Intent.EXTRA_SHORTCUT_INTENT

The Intent you pass as the extra is the shortcut itself.

Romain Guy
ok - just to clarify - this is code I can reach on the user's device - triggered by a click on a link on a/my web page rendered in a(any) browser I did not write?
JohnTheBarber
No, you cannot do this from inside a web page.
Romain Guy
Thanks - is this because Android doesn't support applets? (and not to split hairs - but shouldn't the answer say "no you can't"?
JohnTheBarber