开发者

Spawn Android desktop widget from an application

开发者 https://www.devze.com 2023-02-05 20:25 出处:网络
I have an Android application does many things. I would like to be able have it spawn a desktop widget (?) that opens the application to do a specific thing when the widget is clicked.

I have an Android application does many things. I would like to be able have it spawn a desktop widget (?) that opens the application to do a specific thing when the widget is clicked.

Can someone give me a road map on how t开发者_如何学Co do this?


As far as i know, Android applications can not add App Widgets to the home screen. Applications can define App Widgets, but user has to add them manually to the home screen.

However it is not hard to launch Activitys from a widget using PendingIntent.


This is called AppWidget and is described in details in Android documentation (both references and step-by-step guide). Note, that it's the user that adds the widget to his launcher screen. AFAIK there's no way to add it to launcher in code (though HTC might have some undocumented ways).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号