Hi
In my android application i would like to set alarm for particular time.
I am using the below code.I am able to view the toast but no ring or alert is observed.
Could anyone please let me know if i can display the toast with an default alarm tone.
int newAlarmPeriod = 15000; // For debugging
Intent alarmIntent = new Intent(this, GroupsCheckAlarmReceiver.class);
PendingIntent sender = PendingIntent.getBroadcast(this,0,alarmIntent, 0);
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
am.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis()+ newAlarmPeriod, newAlarmPeriod, sender);
public class GroupsCheckAlarmReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "Alarm worked.", Toast.LENGTH_LONG).show();
Log.d("XXX", "GroupsCheckAlarmReceiver.onReceive"); }
}
Do i need to set any manifest permissions except receiver registery.
Please share your valuable suggestions.
Thanks in advance 🙂
You probably want to add a standard
Notificationcall as described in this link to yourGroupsCheckAlarmReceiver#onReceivemethod.