finally, this is the right solution, if set to (sun, tus, fri), you must create three alarms in these three days, the following code sets an alarm every Sunday and sends dayOfWeek = 1;
public void setAlarm_sun(int dayOfWeek) { cal1.set(Calendar.DAY_OF_WEEK, dayOfWeek); Toast.makeText(getApplicationContext(), "sun "+cal1.get(Calendar.DAY_OF_WEEK), 222).show(); Toast.makeText(getApplicationContext(), "Finsh", 222).show(); Intent intent = new Intent(this, SecActivity.class); PendingIntent pendingIntent0 = PendingIntent.getBroadcast(this, 0, intent, 0); PendingIntent pendingIntent = PendingIntent.getActivity(this, 12345, intent, PendingIntent.FLAG_UPDATE_CURRENT); Long alarmTime = cal1.getTimeInMillis(); AlarmManager am = (AlarmManager) getSystemService(Activity.ALARM_SERVICE);
Mo'nes Qasaimeh
source share