Flurry is a great tool for tracking the users of your mobile application, producing the sort of data visualisation that makes marketing men smile with glee. Unfortunately, I have discovered that the Android API is good for monitoring usage of Android Activities, but not suited for tracking Android Home Screen Widgets.
The main issue here is that Widgets have a very different (i.e. much longer) life-cycle. For Activities, Flurry documentation recommends tying into the “onStart” and “onStop” life cycle methods, which provide a clear mapping with the creation and subsequent deletion of a given Activity context.
For widgets it’s a little more complicated. What you want to do it tap into the “onEnabled” and “onDisabled” life-cycle methods, so you know how long at least one of your widgets has been installed on the home screen. The problem here is that the widget does not maintain the same context between these two calls, and (if well designed) shouldn’t spend much time being in memory at all.
Take for example a Clock widget, which is triggered repeatedly by an AlarmManager intent and manages to update its UI within the short permitted time span of a BroadcastReceiver. This is extremely efficient from a saving battery perspective(AlarmManager can be configured not to wake up the device), but gives Flurry no scope to maintain a session, or report back usage data over the network (I have no idea how Flurry have implemented this functionality?).

Hence I am seeing incorrect session length values in my Flurry reports, i.e. Flurry is reporting 3-10 seconds (probably the time it takes to initialise my widget) and not the time the widget spends being shown on the home screen (in this example several days).
Unfortunately Flurry have locked down their own forums, and are not returning my support emails.
Does anyone know if this kind of tracking is this possible? Would it help if I spun up a service or cached the context (i.e. leak some memory)? As Flurry reports are delayed, this is very difficult to debug. Could anyone suggest another usage tracking tool that supports Android Home screen widgets?
Posted on Android Developers forum.