Java Code Examples for android.support.v4.app.NotificationCompat#PRIORITY_DEFAULT

The following examples show how to use android.support.v4.app.NotificationCompat#PRIORITY_DEFAULT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NotificationHelper.java    From android with Apache License 2.0 4 votes vote down vote up
public void showPrayerNotification(int prayer, long time, String location) {
    if (!mNotificationPrefs.isPrayerEnabled(prayer)) return;

    int defaults = NotificationCompat.DEFAULT_LIGHTS;
    String prayerName = mPrayerNames[prayer];
    String notification = getPrayerText(prayer);
    Uri toneUri = null;

    int priority = NotificationCompat.PRIORITY_DEFAULT;

    if (mNotificationPrefs.isHeadsUpEnabled()) {
        priority = NotificationCompat.PRIORITY_HIGH;
    }

    if (mNotificationPrefs.hasNotificationTone(prayer)) {
        toneUri = Uri.parse(mNotificationPrefs.getNotificationTone(prayer));
    }

    if (mNotificationPrefs.isNotificationEnabled(prayer)) {
        NotificationCompat.Builder builder = getNotificationTemplate();

        builder.setTicker(notification)
                .setDefaults(defaults)
                .setWhen(time)
                .setContentTitle(prayerName)
                .setContentText(notification)
                .setPriority(priority)
                .setStyle(new NotificationCompat.BigTextStyle()
                        .bigText(notification)
                        .setSummaryText(location)
                );

        if (mNotificationPrefs.isVibrationEnabled(prayer)) {
            builder.setVibrate(PATTERN_VIBRATE);
        }

        if (toneUri != null) {
            builder.setSound(toneUri);
        }

        mNotifier.notify("prayer", prayer, builder.build());
    } else {
        if (mNotificationPrefs.isVibrationEnabled(prayer)) {
            playVibration();
        }

        if (toneUri != null) {
            playRingtone(toneUri);
        }
    }

    cancel("reminder", prayer);
}
 
Example 2
Source File: NotificationOptions.java    From android-play-games-in-motion with Apache License 2.0 4 votes vote down vote up
public void setPriorityAsDefault() {
    mNotificationPriority = NotificationCompat.PRIORITY_DEFAULT;
}