daily pastebin goal
70%
SHARE
TWEET

Untitled

a guest May 16th, 2018 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private final static String manasia_notification_channel = "Manasia Event Reminder";
  2.  
  3. // Create the NotificationChannel, but only on API 26+ because
  4. // the NotificationChannel class is new and not in the support library
  5. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
  6.   //define the importance level of the notification
  7.   int importance = NotificationManager.IMPORTANCE_DEFAULT;
  8.  
  9.   //build the actual notification channel, giving it a unique ID and name
  10.   NotificationChannel channel =
  11.     new NotificationChannel(manasia_notification_channel, manasia_notification_channel, importance);
  12.  
  13.   //we can optionally add a description for the channel
  14.   String description = "A channel which shows notifications about events at Manasia";
  15.   channel.setDescription(description);
  16.  
  17.   //we can optionally set notification LED colour
  18.   channel.setLightColor(Color.MAGENTA);
  19.  
  20.   // Register the channel with the system
  21.   NotificationManager notificationManager = (NotificationManager) getApplicationContext().
  22.     getSystemService(Context.NOTIFICATION_SERVICE);
  23.   if (notificationManager != null) {
  24.     notificationManager.createNotificationChannel(channel);
  25.   }
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top