in alarm aplication, is there unlimited amount of alarms that the user can set ? I'm working on the option of alarm in my project, and i realized that its work only once. If i want be able to make many alarms, how should it be done, with Threads or IntentFilter, or something alse ?
public class AlarmReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
String title = intent.getStringExtra("Title");
NotificationManager notificationManager = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
Intent myIntent = new Intent();
System.out.println("Title: " + title);
switch (title){
case "Weight":
myIntent = new Intent(context, WeightActivity.class);
break;
case "Measure":
myIntent = new Intent(context, measurActivity.class);
break;
case "Pr":
myIntent = new Intent(context, PrsActivity.class);
break;
case "Macros":
myIntent = new Intent(context, DietActivity.class);
break;
}
myIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 100, myIntent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder = (NotificationCompat.Builder) new NotificationCompat.Builder(context)
.setContentIntent(pendingIntent)
.setSmallIcon(R.drawable.dumbbell)
.setContentTitle("Tracker")
.setContentText(title)
.setAutoCancel(true);
notificationManager.notify(1, builder.build());
}
}