I have got a problem with alarmservice - it's set up to go off every hour and it works perfectly fine on my galaxy SII - however, on the wildfire and wildfire S the app hogs the whole system. After looking at logs, it seems that alarm is added and trigered a few times every second. I really don't understand why this is happening and more than that it bothers me, how could this problem be device specifc?
Here is what the log says:
V/AlarmManager( 103): Adding Alarm{44cf66f8 type 0 weat.heria.app} Jan 12 04:43:35 pm
V/AlarmManager( 103): Alarm triggering: Alarm{44cf66f8 type 0 weat.heria.app}
V/AlarmManager( 103): Adding Alarm{44cf66f8 type 0 weat.heria.app} Jan 12 04:43:35 pm
V/AlarmManager( 103): Alarm triggering: Alarm{44cf66f8 type 0 weat.heria.app}
V/AlarmManager( 103): Adding Alarm{44cf66f8 type 0 weat.heria.app} Jan 12 04:43:36 pm
V/AlarmManager( 103): Alarm triggering: Alarm{44cf66f8 type 0 weat.heria.app}
Please help me regarding this.
Edit: here is the code setting the alarm
public void setAlarm(int refreshRate) {
Intent myIntent = new Intent(WeatheriaActivity.this, AlarmService.class);
pendingIntent = PendingIntent.getService(WeatheriaActivity.this, 0,
myIntent, 0);
AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.SECOND, 10);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.
getTimeInMillis(), refreshRate, pendingIntent);
}
PendingIntent.getService()
should be passed a flag for its last parameter, not 0
. I'd try fixing that first.