I am developing a birthday reminder app which will notify user on specified date the birthday event. I have googled web and found alarm manager in android to carry out my task.
But i just want to make sure is this the only way followed in making apps like reminder or we have some methods also
I checked this tutorial
Yes, Alarm Manager is what you want. Don't forget to register a boot receiver to set your alarms back up after a reboot.
Also no this is not the only way. but other ways are more complicated still, and potential less reliable. For example you could save the date/time to a server, and have it send a push notification to set off the alarm at the appropriate time.
However Alarm Manger was intended for things like this, so best use it. There is always more than one way to do things, and any clever person can come up with a hackish way to do something. But Alarm Manager is easy, and standardized.
Related
I need notifications like Google keep which run at a specified time even when app is not running. I mean reminder notifications, which remind according to the time set. There are lot of applications which do this like ColorNote.
I know how to create a notification. I don't know how to schedule it a later time , even when app is not running.
You need to create a Service to keep going while your app is not running, and set an alarm using AlarmManager to schedule your action.
Read about the right way to do repeating alarms here:
https://developer.android.com/training/scheduling/alarms.html
And about Services here:
http://developer.android.com/guide/components/services.html
I want my app to do is: Once a day check if the user have written a note, If not, add a notification to the statusbar, reminding the user to start the app, and write a note.
Can I use the alarm-manager or do I have to use a Service for this? Do anyone know where to find a good tutorial on this, or have some example code ?
Use AlarmManager. Permanently running a Service just for scheduling a regular task would be an overkill.
Have a look at this question, for example: AlarmManager Android Every Day
I am newbie to android and just can do small simple tasks with android. Now i am trying to learn a bit harder things.
I want to build an application just like to-do task manager. In which i want to include feature of setting reminder for every particular task, the rest i would be able to handle. Can anyone please guide me or provide me tutorial for setting reminder. I think this includes a background service which constantly monitors the time and date, for a particular event to occur, and when that time and date matches to the task in the application it popups a reminder. Also, this service should start automatically even after restarting the phone. Please someone can guide me through if my direction of thinking is somewhat correct...
You may use AlarmManager and BroadCastReceiver that receives your alarm.
Note: The Alarm Manager is intended for cases where you want to have your application code run at a specific time, even if your application is not currently running.
I have to develop android app which must schedule different notifications in a distinct date that is in the future. I have the idea to not schedule using AlarmManager in an Activity class for all notifications in the same time in my app but instead using a service in the app that can each 24h(= per day) verify if there is one or more than one notification to show today for the user of my app. My datas are many dates in the future that specify the time when the user must be notified. What is the best practice ? And you 're welcome if you have another kind of solution.
I don't think it's a good idea to implement a service for alarms like you describe. AlarmManager was made for this purpose. If you were to implement a service, first you would be taking resources 24/7, and the user isn't going to like that. Second, how are you going to notify the user if the device is asleep? It seems overly complicated. Is there a reason you don't want to use AlarmManager?
Is there a way to send a notification to the user that app has been downloaded but a certain task from the app is not yet complete even after certain period - say a month. One way is a background service which should come alive every month in this case, check the app state (in sharedprefs) and then send a notification. Is there some other easier way in Android without writing custom service.
Here's how I would do it. Schedule an alarm using the AlarmManager to go off a month from today. That alarm can trigger some code inside of a Receiver or otherwise to check whether the said event has occured. If it hasn't, you can then show a Dialog or whatever.
In order to wake up your app after some amount of time (in your example a month) you're going to have to set an alarm. You can use AlarmManager for that. If all you're going to do is check SharedPreferences, you can do that in a broadcast receiver. You can send your notification there.