I would like to ask some questions and getting your advise regarding to reminder notification, I have no experience in coding Java and this is my first trying develop Android app. My apologize for if my questions are duplicated.
The brief of what I need is : In my app, I have a setting for user to set Reminder and they can choose what time(from ListPreference) to keep remind them daily.
So my question is which one should I use
AlarmManager - as same as this Implement Notification Reminder? But I have a doubt on this, if the apps is not running(not opened) will the reminder still sending?
Firebase Cloud Messaging - If use FCM, how do I schedule and trigger to send push notification for reminder at specific timing to specific user?
Any Other simple method?
I have tried this method--> Write a function with nodejs to check the data change in Firebase to send notification to the app; deployed nodejs to Firebase Function. But the thing is i don't know how to schedule a job to keep changing data in firebase, it works when i manual keyin data. I think this is not the correct way, should not talking to database just to implement a simple daily reminder. Also this is not recommend method, right?
Hope I will get simplest advise from you all. Thanks
You could use the AlarmManager to set daily reminder but its not highly accurate after API Level 19(Kitkat)
And yes it will work when you app stops no issue but if your phone restarts you need to use the broadcast receiver which trigger when phone reboot and set the alarm again.
Or you could use this library Evernote android job which is very efficient when it comes to Scheduling and reminders.
I am using it in my app which have schedules on daily and weekly basis and its working perfectly.
Related
I am developing an android app which is about meal subsciption.
I update the entire menu(breakfast, lunch , dinner) for each day in the morning( I am using firebase).
Now i want to send scheduled notification to users that is, i want to notify a user at 1pm that this is the coming menu for the lunch similarly i want to notify the user at around 8pm that this is the coming menu of dinner.
What should i use to get this scheduled notification?
I had an idea in mind that when i update the database in the morning. I will send a data payload with the required scheduling time using cloud messanging and schedule the notification on the device itself.
Will this work?
Yes, it will work, I recommend using Worker to schedule notification and take into account receiving notifications while the app is in the background, because your app should have that feature I guess.
I have to implement a reminder - make the note, then store it in local DB and then make the notification when time comes. I have no experience in mobile development so I'm asking what's better - to implement some time manager that will invoke notifications instantly or store the notifications "as is" to let them be activated by themselves.
What is good approach?
EDIT: I forgot to mention, that I use Xamarin and I've already implemented cross-platform notifications, but now the problem is to choose right way to store and handle them
Use AlarmManager, record your title, message or details of reminder in Database. When alarm is triggered, query your Database to get Title and Message of your notification and show it.
Links:
Services (AlarmManager)
Notification
I'm building an app using cordova most likely Android/ios. My app need to send a reminder to the user and ideally that notification would bring the user to the app. The app might and is most likely not running when the notification kicks in. The next notification is knows by the app in advance and does not need Internet to find the content of the notification. Currently the data is in localstorage so might not be accessible by native code ?
The way I see it would be a cron job running everyday at a specific (configurable) hour, then notify the user if it has to.
I wonder what is the best way to achieve this. Here's what I've found so far:
Dialog/notification plugin in cordova, but that seems to kick in only when the app is running.
Push notification plugin : from a first sight perspective, this seems to be Internet pushed notification and not really what I need.
Specific code for different platform. In Android : a service using an AlarmManager to kick in at the right time and send a Notifications when necessary. This would need access to the localstorage in native code, or store the data elsewhere and is platform dependant, but looks like the only solution so far.
Something else ?
What is the best solution ?
Thanks
I think you need this plugin. Katzer It runs locally, so no internet dependency. Can repeat itself monthly, weekly, daily etc. Notification can be given when app is closed.
I am trying to make a reminder application on Android. I have taken data from the user and saved in a database. How do I trigger an alarm or push notification on user entered date?
To create push notification, you have to register on console API. but I can't post link , because of low reputation and get your own key. Personally I used this tutorial to create and handle push notification.
http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/
but I can't understand why do you need it to alarm user.
To implement alarm after some elapsed time, you can create Service:
http://developer.android.com/reference/android/app/Service.html
There you can create your own alarm or use one of the standard. Sorry, I can't provide code example, because your question is too general.
Insert the information into the Calendar application with the appropriate settings and you will get an alarm when the event occurs.
I have an app which is on Android and iOS. I have added a local notification to fire every 24 hours at a time specified by the user of the app. In Android, the local notification functionality is exactly what I need, but in iOS it seems to lack the functionality I need, unless maybe I am missing something...
Lets say the user sets the time the notification is to fire to 11:00am. In Android, at 11AM, it will wake up the app, go to the broadcase receiver and I am able to run code in a method that calls out to an API to fetch the latest data. Once it gets the data, it posts the notification to the user.
In iOS, it seems the data being posted to the user has to be pre-scheduled. So I have to create the notification message during scheduling of the notification. What I need is to be able to do something more like the above example.
So the problem is that at the time of when the notification is scheduled to fire, I need to check for fresh data, not the day before...
Any suggestions?
The same functionality doesn't exactly exist on iOS.
You can setup a local notifications using the functionality of a UILocalNotification object. With this you can set fireDate, etc. which is sort of like a push notification without a server. You can send a message, add a badge on the app icon, play a sound, etc.
Now the issue is that the app doesn't get launched by the OS. The app simply registers a notification in the OS, which is then handled at the fireDate time. This means you won't be able to have a chance to check for data and verify whether to continue with the notification, etc.
UILocalNotification Class Reference