在 Android 中将书签推送到用户的主屏幕
Android 2.1(不确定这有多重要)我的测试硬件是摩托罗拉 Droid(也不确定这有多重要)
我想在用户单击链接时将书签/互联网快捷方式推送到用户的主屏幕- 通过他们选择的浏览器。
我知道他们通常可以自己设置书签,然后选择将其放在主屏幕上。但我想提供一个链接,例如“在主屏幕上放置此页面的快捷方式” 它负责处理后台/下面的所有事情。
这可能吗?我需要访问框架的哪些部分才能实现这一目标?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,你可以。首先,您需要请求“com.android.launcher.permission.INSTALL_SHORTCUT”权限。然后,使用操作“com.android.launcher.action.INSTALL_SHORTCUT”广播 Intent 并添加以下额外内容:
- 类型 = 意图
- Name = Intent.EXTRA_SHORTCUT_INTENT
您作为额外传递的 Intent 是快捷方式本身。
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.