Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Dec 7th, 2018 51 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. @Override
  2. public void onCreate() {
  3.     super.onCreate();
  4.     if (Build.VERSION.SDK_INT >= 26) {
  5.         String CHANNEL_ID = "my_channel_01";
  6.         NotificationChannel channel = new NotificationChannel(CHANNEL_ID,
  7.                 "My Channel",
  8.                 NotificationManager.IMPORTANCE_DEFAULT);
  9.  
  10.         ((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE)).createNotificationChannel(channel);
  11.  
  12.         Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID)
  13.                 .setContentTitle("A service is running in the background")
  14.                 .setContentText("").build();
  15.  
  16.         startForeground(1, notification);
  17.     }
  18. }
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