0
Q:

notification.priority_high deprecated

NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    String NOTIFICATION_CHANNEL_ID = "my_channel_id_01";

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    NotificationChannel notificationChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, "My Notifications", NotificationManager.IMPORTANCE_HIGH);

    // Configure the notification channel.
    notificationChannel.setDescription("Channel description");
    notificationChannel.enableLights(true);
    notificationChannel.setLightColor(Color.RED);
    notificationChannel.setVibrationPattern(new long[]{0, 1000, 500, 1000});
    notificationChannel.enableVibration(true);
    notificationManager.createNotificationChannel(notificationChannel);
}


NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID);

notificationBuilder.setAutoCancel(true)
        .setDefaults(Notification.DEFAULT_ALL)
        .setWhen(System.currentTimeMillis())
        .setSmallIcon(R.drawable.ic_launcher)
        .setTicker("Hearty365")
        .setPriority(Notification.IMPORTANCE_HIGH)
        .setContentTitle("Default notification")
        .setContentText("Lorem ipsum dolor sit amet, consectetur adipiscing elit.")
        .setContentInfo("Info");

notificationManager.notify(/*notification id*/1, notificationBuilder.build());
0
// create ios channel
        NotificationChannel iosChannel = new NotificationChannel(IOS_CHANNEL_ID,
                IOS_CHANNEL_NAME, NotificationManager.IMPORTANCE_HIGH);
        iosChannel.enableLights(true);
        iosChannel.enableVibration(true);
        iosChannel.setLightColor(Color.GRAY);
        iosChannel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
        getManager().createNotificationChannel(iosChannel);
0

New to Communities?

Join the community