I am setting an alarm like thus:
AlarmManager mgr = (AlarmManager)
activity.getSystemService(Context.ALARM_SERVICE);
mgr.setRepeating( AlarmManager.RTC_WAKEUP, msecs, INTERVAL_MSECS,
pendingIntent );
to go off at 3am in the morning.
the alarm gets caught by a broadcast receiver. in the onReceive
method of the broadcast receiver, I am acquiring a wakelock and
starting a service.
@Override
public void onReceive(Context context, Intent intent) {
PowerManager mgr = (PowerManager)
context.getSystemService(Context.POWER_SERVICE);
lock = mgr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
WAKELOCK_NAME);
...
context.startService(new Intent(context, MyService.class));
in my service I am trying to start my app --
@Override
public void onStart(Intent intent, final int startId) {
super.onStart(intent, startId);
Intent intentStartMyActivity = new Intent(Intent.ACTION_MAIN);
intentStartMyActivity.putExtra("com.test.main", true);
startActivity( intentStartMyActivity );
I have some additional logging my start activity and discovered that
sometimes this works and sometimes it doesn't. It will work like 4
nights in a row and then on the 5th night, it won't work, and then it
will work three more times after that. Any ideas on why it might
'sometimes' not work?
tia.
--
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