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
Related
Im developing an app with a feature by which people can set reminders for themselves for various events (like take medicine with dosage amount). The user should be able to
1) Set a time for the reminder
2) Set a date for the reminder and choose between recurring/ non-recurring
3) When the alarm gets triggered, a notification should be built for the user
4) Alarm should have a snooze option as well
I know how to use notification builder to add a notification with a pending intent and have read documentation on Alarm Manager but Im still completely lost with this task. Could someone please give me some guidance or help?
It seems that the following will supply sufficient documentation on interfacing with alarms in the android SDK.
https://developer.android.com/training/scheduling/alarms.html
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 am trying to broadcast an EVENT_REMINDER in order to cause the system to popup a notification. Is it possible or do I have to hit the route of implementing a Sync Adapter? That seems too much for such a simple task. I know some broadcasts are protected (CALL, SMS) but this should not be the case.
Intent intent = new Intent();
intent.setAction("android.intent.action.EVENT_REMINDER");
sendBroadcast(intent);
Thanks in advance!
I don't want to pop a Notification I want to simulate an event reminder programmatically
I have no idea what you think an "event reminder" is that isn't a Notification -- every device on which I use the Calendar app, event reminders are Notifications. Also, please note that what you claim in your comment runs counter to your first sentence of your question, where you specifically state that you want to "popup a notification":
I am trying to broadcast an EVENT_REMINDER in order to cause the system to popup a notification.
Regardless, the AOSP calendar app will not respond to your broadcast. From the manifest, you need to have a content:// Uri in the Intent, and presumably that will need to point to an actual calendar entry. And I would not be surprised if devices that replace the AOSP calendar app with their own do not support the broadcast at all.
I want to create my alarm app.
but, I don't want to re-design a new alarm clock function.
so, I want to use android built-in alarm clock.
what I want the procedure is:
use android built-in alarm clock to set the time.
when the alarm is ring, my alarm app will be launched to replace built-in one.
use my alarm app to dismiss the alarm.
How could I make it?
Thank you so much.
How could I make it?
You can't. The only thing an SDK app can do with respect to the device's own alarm clock app is to display an activity to allow the user to set the alarm, with a filled-in set of values.
I have an android application that gets data from the web such as an event title, location, date and time. I'd like to alert the user when it is time for the event. I've tried using the calendar API but that seems to be quite vague and unsupported by android. Are there any other ways to alert a user when there is an upcoming event based on the date and time I supply? Being able to set an alarm or something would do as well.
Status bar notifications or Toast would be the classic way. Read:
Notifying the User
http://developer.android.com/guide/topics/ui/notifiers/index.html
There are notifications started by a service so your application doesn't need to be running. Inside your Activity you can use Toasts or Dialogs.
Regarding your kind of information you want to provide I recommend to use a notification.
You can schedule notification using the AlarmManager. And notification can be created using NotificationManager.
You can perform the post of notification in an intent service. Schedule the intent that starts your IntentService with AlarmManager and than inplement the post in onHandleIntent() method. Notification body parameters can be passed as intent extras to you service.