Hi,
I want to add an alarm, so I used the following code:
public void SetAlarm(Alarm alarm)
{
mTimeTarget = PendingIntent.getBroadcast(mContext, alarm.getRowID(),
new Intent(HomeScreen.ACTION_CHECK_TIME_ALARMS), PendingIntent.FLAG_UPDATE_CURRENT);
mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, alarm.getAlarmTime().toMillis(true), mTimeTarget);
}
But this doesn't seem to work. (I tried on the emulator, and when the time comes, nothing happens - my onReceive function on my class that extends BroadcastReceiver isn't called).
Here is how I initialized mAlarmManager on the constructor (it is private because this class is singleton):
private AlarmsManager(Context con)
{
mContext = con;
mAlarmManager = (AlarmManager) con.getSystemService(Context.ALARM_SERVICE);
}
Any idea what I did wrong? Thanks!