I am creating to-do app project in Android Studio, language is Kotlin. I have created Email/Google signIn, signOut and create/read/update/delete task functions. Each created task object has selected by user datetime, and tasks for each account are storing in Firebase Realtime Database. After realising those functions I started to integrate notifications to my app, and there was a problem. How can I do that? Should I use Firebase Cloud Messaging or do notifications locally. I tried to use FCM but, thing that I couldn't understand and I couldn't find any information for this topic is how to schedule notification to selected by user date and send it to device? Can anybody help pls. This is my first kotlin project, and I am new at android development
Asked
Active
Viewed 778 times
0
-
I have explained in one of my tutorials step by step, how you can send [notifications](https://www.youtube.com/watch?v=6RzB4HXzQyA&t=3s&list=PLn2n4GESV0AmXOWOam729bC47v0d0Ohee&index=17) to specific users using Node.js. You can also take a look at my answer from this [post](https://stackoverflow.com/questions/48298993/push-notifications-on-content-change/48299840). – Alex Mamo Apr 17 '22 at 10:22
2 Answers
0
I recommend you to watch this video https://www.youtube.com/watch?v=B5dgmvbrHgs&t=674s&ab_channel=CodePalace
If you can't, I will send you my own code, but it will be difficult for you to change it according to yourself, I made it with this video.
I also did it with a data from the firebase database, but I could not use FCM. I do not recommend

Ömer Seyfettin Yavuzyiğit
- 687
- 7
- 10
-1
This should help you, Firebase Notification Scheduler
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\r\n \"payload\": {\r\n \"to\": \"<Device FCM token>\",\r\n \"notification\": {\r\n \"title\": \"Check this Mobile (title)\",\r\n \"body\": \"Rich Notification testing (body)\",\r\n \"mutable_content\": true,\r\n \"sound\": \"Tri-tone\"\r\n }\r\n },\r\n \"sendAt\": \"2022-08-29T09:12:33.001Z\"\r\n}")
val request = Request.Builder()
.url("https://firebase-notification-scheduler.p.rapidapi.com/messages")
.post(body)
.addHeader("content-type", "application/json")
.addHeader("Authorization", "undefined")
.addHeader("X-RapidAPI-Host", "firebase-notification-scheduler.p.rapidapi.com")
.addHeader("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.build()
val response = client.newCall(request).execute()

VoteCoffee
- 4,692
- 1
- 41
- 44

Rashid Abdulla
- 295
- 2
- 10