n my alarm clock I use the following code to enable signals:
Intent i = new Intent(AlarmReciever.ACTION_WAKEUP);
i.putExtra(AlarmDao.ID_COLUMN, a.getId());
PendingIntent pendingIntent = PendingIntent.getBroadcast(
context, a.getId(), i, PendingIntent.FLAG_CANCEL_CURRENT);
Calendar cal = a.getNextAlarm();
if(cal!=null){
AlarmManager alarmManager = (AlarmManager)
context.getSystemService(context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
pendingIntent);
if(toast) showToast(context, cal);
}
My receiver starts service, that plays music and show "switch off"
dialog.
onReceive(....
context.startService(wakePlayer);
context.startActivity(wakeWindow);
...}
The problem with this code is that sometimes it fails. I mean it
doesn't start music and show the dialog. Have anyone faced the same
problem?
--
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