Notifying AIR App from Android Native Extension WakefulIntentService
===

I need an AIR Native Extension for Android to periodically wake up and send an event (using FREContext.dispatchStatusEventAsync) so that I can retrieve the event in the AIR app.

I was able to create an ANE that uses the WakefulIntentService, and as an example I'm just appending the current date/time to a file so that I can confirm the AlarmManager is properly waking up the device and notifying my ANE.

This is what is currently working:

 1. AIR App creates a PowerManagerExtensionContext (name of my ANE) and calls the SetSleepInterval FREFunction.

 2. From the FREFunction I am able to use the FREContext passed in and call:

    context.dispatchStatusEventAsync("debug 1", "status");

    This works well, I retrieve the status event in the AIR app with no problem.

 3. I then kick off the WakefulIntentService broadcast as done [here][1].

    activity.sendBroadcast(new Intent(activity, OnBootReceiver.class));

 4. I am successfully notified by the Android AlarmManager at the interval I set in the AlarmManager::setRepeating method. 

 5. I would like to notify the AIR app whenever the alarm 'goes off'. I haven't been able to find a way to properly keep a reference to the FREContext to be able to notify the AIR app at each interval.

Can anyone help with how to properly pass the FREContext to the WakefulIntentService? Or, does anyone know if this is not possible...perhaps I can send an intent to restart the AIR app (hoping to avoid doing this, but if that would work then I can deal with it)?

  [1]: https://github.com/commonsguy/cwac-wakeful/tree/master/demo2/src/com/commonsware/cwac/wakeful/demo2