1if (Build.VERSION.SDK_INT >= 26) {
2 String CHANNEL_ID = "your_channel_id";
3 NotificationChannel channel = new NotificationChannel(CHANNEL_ID,
4 "Notification Channel Title",
5 NotificationManager.IMPORTANCE_DEFAULT);
6
7 ((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE)).createNotificationChannel(channel);
8
9 Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID)
10 .setContentTitle("")
11 .setContentText("").build();
12
13 startForeground(1, notification);
14 }
15