How to set more than one alarm for calendar events in android?
I have already worked on calendar events and for each event the alarm should ring with notification. The problem i face is, If i set more than one event, the last set event is alone notifying the user with开发者_运维知识库 alarm. But all the other events doesn't ring alarm. Any Help is appreciated and thanks in advance...
If you create the alarm with the Single Intent instant you need to pass the different Request code into the getService() method.
Or if you elsewhere you can create multiple instant of the intent and with different request code you can set it
here snippet of code updated
AlarmManager alarms = (AlarmManager)context.getSystemService(
Context.ALARM_SERVICE);
Intent i = new Intent(MyReceiver.ACTION_ALARM); // "com.example.ALARM"
i.putExtra(MyReceiver.EXTRA_ID, id); // "com.example.ID", 2
PendingIntent p = PendingIntent.getBroadcast(context, requestcode, i, 0);
here the second parameter of getService was request code you need to set the different request for multiple alarm.
精彩评论