I want to build notifications that are showed recurrently in specific days of the week, for example, I want X notification every monday and friday of each week. I know how to set intervals with alarms, but not how to select specific days
Asked
Active
Viewed 169 times
2 Answers
2
You can set repeating alarm for every day and show notification only those days that are needed on onReceive() function of the alarm BroadcastReceiver.

rya
- 1,417
- 1
- 16
- 29
-
1I think I go to do this, I guess this can be easier if the servers manage the notifications, but I dont have controll over that. thank you – Paolo Donato Navarro Dec 10 '20 at 21:02
-
1dont know why question have downwote btw ur answer rocks – Sãúrâßh Jáðhàv Jul 28 '22 at 14:02
1
The logical way to control push notification timing is from server side but if you want to do it on your phone you must work with android os date and time and Java CALENDAR class.

Afshin Samiei
- 99
- 5
-
The `Calendar` class (capital C then small letters) is poorly designed and long outdated. While I believe the alarm manager was designed to work with it, I still prefer to use `ZonedDateTime` and/or other classes from [`java.time`, the modern Java date and time API,](https://docs.oracle.com/javase/tutorial/datetime/). Yes, you can use it on Android. For older Android see [desugaring](https://developer.android.com/studio/write/java8-support-table) or [How to use ThreeTenABP …](https://stackoverflow.com/questions/38922754/how-to-use-threetenabp-in-android-project). – Ole V.V. Dec 11 '20 at 05:56