开发者

android widget and localservice bind

开发者 https://www.devze.com 2023-01-17 10:02 出处:网络
I writing player, it has main activity that runs localservice. I can\'t find how开发者_如何学C bind localservice to widget.

I writing player, it has main activity that runs localservice. I can't find how开发者_如何学C bind localservice to widget. When i trying to bind it like in activity it fails.

Plz help me.

Adding #1 How can I contact with background service when? http://www.developer.com/ws/data/article.php/10944_3843561_1/Handling-Lengthy-Operations-with-Android-App-Widgets.htm

here i found something, but it doen't work for me.


You cannot bind to a service from an AppWidgetProvider.


You can bind to a service from a AppWidgetProvider like so:

context.getApplicationContext().bindService(intent, ServiceConnection, Flags);

The context is the parameter on the onUpdate method.

0

精彩评论

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