All,
I have some doubt in basics .kindly help me to resolve it. in which scenario we will use Alarm manager and in which scenario we will use Notification.
Here is my understandings-Alarm-General Wakeup alarm
Notification-used to notify new events...
If the above thing is correct please help me where the REMINDER will falls.
Alarm manager is not a user notification system but an event for the phone to wake up and do something at a certain time.
Notifications are what you would use to notify the user of an event.
You can wire this all together using a BroadcastReceiver to capture the alarm manager events and start a notification.
Here's a simple example of how to do it.
Related
I have been using alarm manager for firing up notification when alarm is called. But the problem is that I have to implement particular permision to use Alarm and the user might not like this hindrance on our part.
Is there any other way to show repeating notification for ex. in crossy roads, where I don't have to use Alarm manager to repeat notification. Also I am not interested in utilizing push notification ( to avoid useless hassle).
In short:
1.) I want to notify user to start my app in regular interval
2.)Without using alarm manager and push notification.
Thanks!!!
I have to implement particular permision to use Alarm
No, you do not.
The permission to use Alarm Manager or set alarm permission.
That is only needed by the setAlarmClock() method, at most. The regular AlarmManager methods (e.g., set(), setRepeating()) do not need this permission.
Alarms get wiped out on a reboot. If you wanted to re-establish those alarms automatically on a reboot, you would need the BOOT_COMPLETED permission to arrange to get control at that time. However, you might wish to re-establish the alarms at some other time (e.g., when the user next runs your app), and so BOOT_COMPLETED is optional.
I need to integrate, in my android application, a calendar from which i can set new event.
I know that is possible call the android calendar (using intent), but what I need is slightly different, for this reason:
I need that when the time of the event is reached, some code is started, and no default notification occurs! In other words I want create a custom notification when alarm of event goes off. Maybe I need to use AlarmManager
How can I solve this problem?
If your problem is that you need to launch some kind of intent at a specified time then you can use AlarmManager. It allows you to schedule your application to be run at some point. When an alarm goes off, the Intent that had been registered for it is broadcast by the system.
For More information about AlarmManager, you can check this link : AlarmManager
I am new to notifications in Android and I want the app to display a notification once every Sunday. I am not sure how to do this when the activity is not running.
Thank you in advance!
You should start reading and understanding how alarms works: here then you can make the alarm activate the notification on given time.
NOTE: that the alarms won't get saved after reboot so you will need to add a boot complete receiver.
So in my app I'm looking to have the students class schedules and the times which they need to be in class.
When the app is turned off I still want the notification to pop up that their class is about to start (possibly vibrate).
This sort of functionality is very akin to an incoming text message or notification of something like an email. I was wondering how to implement that into an app?
You need a Service which can run when the app is not opened. You should also think about a BroadcastReceiver that listens to BOOT_COMPLETED
You will need to use the AlarmManager to set an alarm when you require the notification, possibly with the RTC_WAKEUP flag so the device will wake from a sleep. From your alarm receiver you will need to take a wake lock (if you used RTC_WAKEUP) and start a service that will use the NotificationManager to display a message to the user (very similar to the incoming SMS message).
As #WarrenFaith pointed out you will need to create a BOOT_COMPLETED receiver to re-establish the alarm after the phone is rebooted as they are not persistent.
I'm new with Android programming. I'm just wondering whether its possible to set up auto notification. For example, every morning at 8am, the app will send a notification to user about something. Is this possible? Which area/class of Android programming should I look at? Thanks!
You should have a look at the Alarm Manager. You will need to use either of the 'set' methods, and give it a PendingIntent that will perform a broadcast or start an intent service that wakes up just to show the notification. For the broadcast, you will need to have a receiver in your app, that makes a Notification and shows it.