Java Code Examples for com.android.calendar.alerts.AlertReceiver

Following code examples demonstrate how to use com.android.calendar.alerts.AlertReceiverfrom android. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use com.android.calendar.alerts.AlertReceiverand various code implementation of this class.

    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
        Activity a = getActivity();
        if (key.equals(KEY_ALERTS)) {
            updateChildPreferences();
            if (a != null) {
                Intent intent = new Intent();
                intent.setClass(a, AlertReceiver.class);
                if (mAlert.isChecked()) {
                    intent.setAction(AlertReceiver.ACTION_DISMISS_OLD_REMINDERS);
                } else {
                    intent.setAction(AlertReceiver.EVENT_REMINDER_APP_ACTION);
                }
                a.sendBroadcast(intent);
            }
        }
        if (a != null) {
            BackupManager.dataChanged(a.getPackageName());
        }
    } 


Advertisement
Javadoc
Receives android.intent.action.EVENT_REMINDER intents and handles event reminders. The intent URI sp

ecifies an alert id in the CalendarAlerts database table. This class also receives the BOOT_COMPLETED intent so that it can add a status bar notification if there are Calendar event alarms that have not been dismissed. It also receives the TIME_CHANGED action so that it can fire off snoozed alarms that have become ready. The real work is done in the AlertService class. To trigger this code after pushing the apk to device: adb shell am broadcast -a "android.intent.action.EVENT_REMINDER" -n "com.android.calendar/.alerts.AlertReceiver"

Read More
Advertisement