I'm setting multiple alarms on repeat through alarm manager. all are working fine for the day i'm setting them but none of it is getting repeat. here is my broadcast receiver.
public class AlertReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String[] myStrings = intent.getStringArrayExtra("strings");
Log.i("okk", "cathing intent values through break" + Arrays.toString(myStrings));
createNotification(context, "Time is here baby", "5 sec hogae hen beta", "Alert");
Log.i("okk", "cathing intent values through break" + Arrays.toString(myStrings));
}
public void createNotification(Context context, String msg, String msgText, String msgAlert) {
final int _id = (int) System.currentTimeMillis(); // for unique request code
// PendingIntent notificationIntent = PendingIntent.getActivity(context, _id, new Intent(context, MainActivity.class), 0); // changed from 0 to _id
NotificationCompat.Builder mbuilder = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.cast_ic_notification_play)
.setContentTitle(msg)
.setTicker(msgAlert)
.setContentText(msgText);
// now intent we want to fire when noti is clicked
mbuilder.setContentIntent(notificationIntent);
// how person is notified
mbuilder.setDefaults(NotificationCompat.DEFAULT_SOUND);
mbuilder.setAutoCancel(true); // noti dismisble when user swipe it away
NotificationManager notificationManager = (NotificationManager)
context.getSystemService((Context.NOTIFICATION_SERVICE));
notificationManager.notify(1, Ignore()); // changes from 1 to _id
}
}
// and here is where i'm setting the notification on repeat
final int _id = (int) System.currentTimeMillis();
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
// alarmManager.set(AlarmManager.RTC_WAKEUP, Allah[i],
// PendingIntent.getBroadcast(this, _id, alertIntent, PendingIntent.FLAG_UPDATE_CURRENT));
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,Allah[i],AlarmManager.INTERVAL_DAY,
PendingIntent.getBroadcast(this, _id, alertIntent, PendingIntent.FLAG_UPDATE_CURRENT));