19.04.2011 21:48, Brad Stintson пишет:
When I set alarm for few mins from current time, it shows this
Elapsed realtime wakeup (now=1263900):
ELAPSED_WAKEUP #0: Alarm{43d52750 type 2 android}
type=2 when=112231046 repeatInterval=0 count=0
operation=PendingIntent{43c2e498: PendingIntentRecord{43c5abb0
android broad
castIntent}}
This one is a different time of alarm, ELAPSED_REALTIME_WAKEUP, which is
specified with milliseconds since boot.
The "now" value above is about 20 minutes since boot, whereas the "when"
value is over 31 hours. This doesn't compute for testing.
A more typical alarm of this type might be:
Elapsed realtime wakeup (now=*711975424*):
ELAPSED_WAKEUP #0: Alarm{452f1648 type 2
com.google.android.apps.gtalkservice}
type=2 when=*712046996 *repeatInterval=0 count=0
operation=PendingIntent{4549a598: PendingIntentRecord{44eadc18
com.google.android.apps.gtalkservice broadcastIntent}}
The above says that my device was rebooted some 197 hours ago, and the
alarm is set to go off some 70 seconds from now.
Your previous code snippet used RTC_WAKEUP, which uses "real" time (in UTC).
Which of the two - ELAPSED_REALTIME_WAKEUP or RTC_WAKEUP are you
actually trying to make work?
To test your intent and receiver, you could do this:
Intent activate = new Intent(this, TimeAlarm.class);
PendingIntent alarmIntent = PendingIntent.getBroadcast(this, 0,
activate, 0);
alarms = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
alarms.set(AlarmManager.RTC_WAKEUP, *System.currentTimeMills() + 30
* 1000*, alarmIntent);
The above alarm is set to go off in 30 seconds, and is an easy way to
test if your intent / receiver / manifest / etc. are correct.
--
Kostya Vasilyev -- http://kmansoft.wordpress.com
--
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