Java Code Examples for android.support.v4.app.NotificationCompat#DEFAULT_LIGHTS
The following examples show how to use
android.support.v4.app.NotificationCompat#DEFAULT_LIGHTS .
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: NotificationsService.java From ForPDA with GNU General Public License v3.0 | 6 votes |
private void configureNotification(NotificationCompat.Builder builder) { builder.setAutoCancel(true); builder.setPriority(NotificationCompat.PRIORITY_DEFAULT); builder.setCategory(NotificationCompat.CATEGORY_SOCIAL); int defaults = 0; if (Preferences.Notifications.Main.isSoundEnabled(getApplicationContext())) { defaults |= NotificationCompat.DEFAULT_SOUND; } if (Preferences.Notifications.Main.isVibrationEnabled(getApplicationContext())) { defaults |= NotificationCompat.DEFAULT_VIBRATE; } if (Preferences.Notifications.Main.isIndicatorEnabled(getApplicationContext())) { defaults |= NotificationCompat.DEFAULT_LIGHTS; } builder.setDefaults(defaults); builder.setVibrate(new long[]{0L}); }
Example 2
Source File: AndroidNotifications.java From actor-platform with GNU Affero General Public License v3.0 | 5 votes |
public void addCustomLedAndSound(Notification topNotification, android.app.Notification result) { if (messenger().isNotificationSoundEnabled()) { result.defaults &= ~NotificationCompat.DEFAULT_SOUND; result.sound = ActorSDK.sharedActor().getDelegate().getNotificationSoundForPeer(topNotification.getPeer()); } result.ledARGB = ActorSDK.sharedActor().getDelegate().getNotificationColorForPeer(topNotification.getPeer()); if (result.ledARGB != 0) { result.ledOnMS = 100; result.ledOffMS = 100; result.defaults &= ~NotificationCompat.DEFAULT_LIGHTS; result.flags |= NotificationCompat.FLAG_SHOW_LIGHTS; } }
Example 3
Source File: Options.java From showCaseCordova with Apache License 2.0 | 5 votes |
/** * @return * The notification color for LED */ public int getLedColor() { String hex = options.optString("led", null); if (hex == null) { return NotificationCompat.DEFAULT_LIGHTS; } int aRGB = Integer.parseInt(hex, 16); return aRGB + 0xFF000000; }
Example 4
Source File: PostNotification.java From Capstone-Project with MIT License | 4 votes |
private void showPostNotification(Post post, Bitmap bitmap) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { showHeaderNotification(); } PendingIntent pendingIntent = PendingIntent.getActivity(mContext, post.getPostId(), PostDetailsActivity.getLaunchIntent(mContext, post.getPostId()), PendingIntent.FLAG_ONE_SHOT); boolean sound = PredatorSharedPreferences.isNotificationSoundEnabled(mContext); boolean light = PredatorSharedPreferences.isNotificationLightEnabled(mContext); boolean vibrate = PredatorSharedPreferences.isNotificationVibrationEnabled(mContext); int defaultFlags = 0; if (sound) { defaultFlags |= NotificationCompat.DEFAULT_SOUND; } if (light) { defaultFlags |= NotificationCompat.DEFAULT_LIGHTS; } if (vibrate) { defaultFlags |= NotificationCompat.DEFAULT_VIBRATE; } NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext) .setColor(ContextCompat.getColor(mContext, R.color.notification_color_child)) .setSmallIcon(R.drawable.ic_notification_predator) .setLargeIcon(bitmap != null ? bitmap : getBitmap(R.mipmap.ic_launcher)) .setContentTitle(post.getName()) .setContentText(post.getTagline()) .setGroup(NOTIFICATION_GROUP_KEY) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setPriority(NotificationCompat.PRIORITY_HIGH) .setDefaults(defaultFlags) .setAutoCancel(true) .setOnlyAlertOnce(true) .setContentIntent(pendingIntent); mNotificationManager.notify(post.getPostId(), builder.build()); }
Example 5
Source File: NotificationHelper.java From android with Apache License 2.0 | 4 votes |
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); }