Besides, this observer monitors data published by a content provider that
lives within the same process (if I'm understanding the structure
correctly).

So if there are changes, it means they were pushed by the content provider,
which in turn means the process was alive.

However, I believe it's still wrong, as I see no reason for the widget
provider's onEnabled to be called each time the process is recreated (such
as by an alarm or the sticky remote views service). Unless, that is, I'm
missing something on app widget lifecycle callbacks.
17.05.2012 18:26 пользователь "Mark Murphy" <[email protected]>
написал:

> The Android Developers site has a Weather List Widget sample app:
>
> http://developer.android.com/resources/samples/WeatherListWidget/index.html
>
> One of the classes in it is WeatherWidgetProvider, which is an
> AppWidgetProvider. This AppWidgetProvider is registering a
> ContentObserver in onEnabled(), by means of a HandlerThread.
>
> Am I missing something, or is this very broken?
>
> AppWidgetProvider is a BroadcastReceiver. Our process may be
> terminated milliseconds after any of the AppWidgetProvider lifecycle
> methods (e.g., onEnabled()) returns, if there are no other components
> running.
>
> So, the way I see it:
>
> -- this code is leaking a thread, as the HandlerThread is not being
> managed by any component
>
> -- this code is unreliable, as once the process is terminated, the
> ContentObserver is gone
>
> Has anyone seen this pattern used in production code?
>
> Thanks!
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android Training in NYC: http://marakana.com/training/android/
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

Reply via email to