Saturday, February 12, 2011

[android-developers] What does/does not belong in WidgetProvider

Widget Provider is a specialized BroadcastReceiver.

Assuming there exists an Application, 1-n android service,1-k
activities, and potentially additional 0-n broadcast receivers that
are not widgets, I would like to verify what belongs and does not
belong logically inside the broadcast receiver. Here are some items ..

And assuming that generally what gets launched is the widget first.

Please comment on any or all of the items as to whether you think they
belong inside or outside the WidgetProvider and why. Pass over any
that you are not interested in. Thanks.

1) If the Application needs to always listen for certain events
whether they show up in the widget or not where should this go? In the
Widget? If not what would keep the broadcast receiver available to
listen to the events for duration of the the application?

2) Should the widget issue notification? or request a service to issue
them? ie should the notification logic reside in the widget itself or
in the service.

3) Should the widget issue broadcasts or ask a service to do this?

4) Should the widget ever access any system services like like
Notification Manager, PowerManager etc Why, Why not?

5) Should the widget keep any of its own state? If it should not keep
state how can it change what it displays? Like a different text or
icon?

6) Should the widget start off activities or let a service handle
this?

7) is it ok to user the context passed to update and receiver or
should one use ctx.getApplicationContext() to do things like
context.startService? ( Perhaps the one passed in is the application
context ? )

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment