INNER CODE UNIT · Java

createNotificationChannel

SkyTubeTeam/SkyTube · app/src/main/java/free/rm/skytube/app/FeedUpdateTask.java:121

    private void createNotificationChannel(Context context) {
        // Create the NotificationChannel, but only on API 26+ because
        // the NotificationChannel class is not in the Support Library.
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            Log.i(TAG, "Create notification channel: "+NOTIFICATION_CHANNEL_ID);
            final NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
            final NotificationChannelCompat channel = new NotificationChannelCompat.Builder(NOTIFICATION_CHANNEL_ID, NotificationManagerCompat.IMPORTANCE_DEFAULT)
                    .setName(NOTIFICATION_CHANNEL_NAME)
                    .setSound(null, null)
                    .build();
            notificationManager.createNotificationChannel(channel);
        }
    }

    private void showNotification() {
        final Context context = SkyTubeApp.getContext();
        final NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
        final NotificationCompat.Builder builder = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…