I create a RTC_Wakeup alarm and use broadcast intent for Alarm.
I test the code on
The strange things is The OnReceive method didn't run at an alarm
time.
When I turn on the screen after alarm time, I can see the code is
being executed.

 The following are some of my code:
Activity class:
        public void startAlarm()
        {
                Context context = AppInfo.getInstance().AppContext;
                mAlarmManager  = newAlarmManager();
                Intent intent=new Intent(context, OnAlarmReceiver.class);
                mAlarmSender = PendingIntent.getBroadcast(context, 0, intent, 
0);

                long triggerAtTime = getTriggerTime();
                mAlarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
                                triggerAtTime,
                                24 * 60 * 60 * 1000,  //one day
                                mAlarmSender);
        }



BroadcastReceiver class:
public class OnAlarmReceiver extends BroadcastReceiver{

        public void onReceive(Context context, Intent intent) {
                AlarmAlertWakeLock.acquireCpuWakeLock(context);
                String currentDateTimeString =
android.text.format.DateFormat.format("yyyy-MM-dd hh:mm:ss", new
java.util.Date()).toString();
                
AutouploadPref.getInstance().logAutoupload(currentDateTimeString);
                }
}

The above code works on some device but not all.
Very strange, and don't know what happened

-- 
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