I want to create an application in android in which the user selects a certain day in the future and then, when that day arrives he will get a notification (I know that this can be done through the Calendar or the notes but that doesn't matter in my case).
I have two problems concerting the previous:
a. How should I implement the notification ? I read elsewhere about adding events to the Google Calendar of the user - but that is not standard. Should I implement a service that checks to see if that day has arrived and add the notificatin ?
b. As I wrote, I care about day only, and not time. This generates the following problem for me: When should I notify the user in order to not bother him ? When the application knows only the day of the notification (and not the time) then how can it determine at what time in that day to actually notify the user ? What if the user is asleep ? Is it possible to add a "silent" notification so that the user won't be bothered ?
TIA,
Serafeim
Both problems are solved by a 'status bar notification'
http://developer.android.com/guide/topics/ui/notifiers/notifications.html
You can add a sound to this to alert the user.
If the user is 'asleep' i.e. the phone is on silent I believe the notification won't make a sound.
A notification does not need a time of day as you can 'notify' at the very start of the day and the user will see it when they first check there phone that day, so time is irrelevant.
You will have a service that runs to check the data yes, then start this notification. It may be possible to have an event listener for some given event that would start your service that would then check the date, and if so post your notification!
Here is my tutorial on this:
http://blog.blundellapps.com/notification-for-a-user-chosen-time/
Enjoy!
Related
I created an app in which user can add events in calendar and I want to give user reminder about their event at specific time. Date and time is already specified in event. I want to set notifications for each event.
I searched about it on google and found about alarm Manager but I am confused on how milli second parameter works. Like I want set alarm for 7:30 PM but don't know how it can be done.
If a reminder is all you want to create, check this out How to Create a Reminder Notification in Android?
If what you are looking for is a whole app concept or rather a full tutorial on how to do this, please follow this guide -> Android Task Reminder App [Source Code Included]
I've read a lot about notifications in iOS now and I'm quite confused about how to reliably schedule notifications, actually. Let me explain my scenario:
I created an Android app that holds a fixed list of dates. The user can not add or remove dates, he can only view that list (garbage removal dates for my area). You can, however, configure that you want to be notified the day before. I've made that app so that when the device starts, a notification timer is started that fires at a certain time, checks whether there are pending items for the next day and if so, shows a notification. Then it re-schedules itself for the next day. So normally, the user doesn't need to open the app at all to receive notifications. He only opens the app once to configure his street, which triggers the first scheduled event, or to actually see the list of upcoming dates.
I'm now trying to port this app to iOS and I understand from what I've read that there's no way to replicate the way I'm doing stuff on Android. I understand that I can create up to 64 notifications for certain points of time in advance, but without the user opening the app at all I can not be sure to reliably schedule all the notifications I may need.
Is there a reliable way to simulate the described Android behavior? Or is there a way to force the user to open up the app once every 30 days or so?
In a nutshell no.
If applicable you can make notifications repeating, but if the dates are random and you can't repeat the notification then you can't schedule more than the limit.
You can't schedule your app to run and you can't force the user to do anything. All you can do is post some sort of notification for 30 days or whenever with some message that you hope will compel them to open your app.
If you have a valid use case for it in your app, you can enable a background mode such as a location change on a cell tower transition for example, then when your app runs in the background re-schedule the notifications. Or remote push, or background fetch etc. But even with background modes you cannot guarantee your app will actually run in the background, you can just help to increase the chances that it might and the different background modes have different degrees of usefulness in this sort of area.
How does an Android alarm app or any other time based notifications app like Calendar, Clock, etc work? More specifically, how does it show up the notifications at exactly the time specified by the user? Does it constantly run in the background and as soon as the required time comes up, does it show the notification? Or does it schedule the notification in Android's kernel before exiting? I am working on an app that needs to give the user notifications at times specifies by him. I am not able to figure out how to do that.
Maybe what you mean is to create an alarm, you can see this example.
I want my app to notify users of specific events that can occur at a certain time.
I know how to send a notification knowing the exact time of it, but things get a little complicated for me when I want to trigger notifications at times that are unknown at app install (notifications whose time can change or which depend on a specific event).
Here are two cases in which I don't know how to trigger a notification :
Send a notification every day at a time that can change from day to day. Say I want to notify users that it's sunrise time, do I need a Service to run permanetly an calculate for each day the time of sunset and trigger a notification when the time comes ?
Send a notification everytime something new in the community occurs. I don't want to notify users of an update, but just of a particular event at a certain time. How do I send notifications to them?
How can I achieve this ?
Thanks !
For your first option i would use a AlarmManager. It will execute a function on a specific time, that can be set on app startup. Everytime the AlarmManager executes and sends a notification to the user, it should re-calculate the next message time and reset the AlarmManager. ( see how to reset here )
For your second scenario you could use a library like OneSignal. It's a verry usefull library for registering users for pushnotifications and sending messages from a website to your users. You can choose groups of users or specific users for sending messages and you can customize the look of your pushmessages ( add buttons, images, .. etc).
I am a new developer and don't know much about android programming. I am trying to make an app that reminds a user to do a particular thing every day at a specific time (like going to gym at 5:30 pm). I am able to get a notification after clicking of a button but i want this to be done by the app i.e. even if the app is not running it will remind me everyday to go the gym at 5:30. How can I get this???
I tried using AlarmManager but it gives my notification at that time only and sets the alarm for the specified time.
Set repeating alarm. on broadcast receiver start your notification