Broadcasting an EVENT_REMINDER - android

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.

Related

android - how to push notification (reminder) on a specific time?

I checked almost all questions in stack overflow and also in google documentation and still couldn't understand what to use exactly for my cases.
What i want is, user will select reminder date in the app and in that time app will send a notification even app is closed or phone restarted between remind set time and remind time.
So what do i need to use? Which classes do i need? Broadcast Receiver, AlarmManager these two is enough or what? a sample of code 20-30 lines would be nice =)
You will need both a few things.
Setup:
You need to set your app to listen for the phone starting by registering for this intent in your manifest.
Basically you when your user selects the time, you will need to:
Save that time in a file/db/shared prefs.
Set the alarm manager to wake up your app at the right time
When the alarm manager sends
you a broadcast, start a service to do the necessary work (broadcast
receivers have to complete their work in a short amount of time, so
it's better to start a service)
In your service, remove the time
from your file/db/shared prefs
If your app ever gets the broadcast that the phone was rebooted, then all of your alarms are lost. You need to reset them using the times you saved in the file/db/shared prefs.
Check Android Developers website for calender intents so you can use them to determine the time etc.
On your broadcast receiver pass the details or timing to the broadcast receiver. Once you do that use the alarm manager etc to check if the time is perfect and simply send a push notification when the time is correct.
I say this assuming that you know already about the calendar, alarm manager, and broadcast receivers intents. If you don't I recommend googling the following with Android Developers appended to it.
Use AlertManager.set to send notification on particular time.
For re-setting Alarm Notification, use
<receiver android:name=".AfterBootReceiver" android:label="AfterBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"></action>
</intent-filter>
and
#Override public void onReceive(Context context,Intent intent){
...
}
to reset AlarmManager.set after device re-booted.

Android: Calendar integration with custom notifications

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

Auto Notification for Android

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.

Android - methods to alert a user?

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.

Modify notification of another app on Android

I'm trying to find out if it is possible to modify the notification of another app (the calendar app from Samsung) from my own app. Specifically I'd like to change the alarm for a calendar event from a one-time sound (which is silent, if the phone is set to vibrate) to a repeating vibrate.
Can I even modify the notifications belonging to a differnt app?
If I can't, could my app get notified about all notifications and just rethrow my own, modified notifications?
You probably won't be able to change the notifications of that app because you'd have to modify the app's code directly, where the notification is being fired.
To your second question: If the calendar app communicates over intents, you could create an app which registers on the desired intent (through an Intent filter). When the appropriate intent is fired by the calendar app, you would see a dialog which lets you choose between the applications which can accept it, where also yours should appear. At the same dialog you could then set your app as the default and then handle the notification of the data properly.
Hypothetically, because in the end it depends on how the mentioned Samsung calendar app has been implemented.

Categories

Resources