• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

NotificationChannel on Xiaomi Redmi 5 plus Android 8.1.0

eldona

Lurker
I create a notification channel with NotificationManager.IMPORTANCE_HIGH:

Java:
NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
String CHANNEL_ID_CALL = "call";
NotificationChannel mChannel = new NotificationChannel(CHANNEL_ID_CALL, context.getResources().getString(R.string.notification_call_channel_name), NotificationManager.IMPORTANCE_HIGH);
mChannel.setDescription(context.getResources().getString(R.string.notification_call_channel_description));
Uri notificationSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
AudioAttributes attributes = new AudioAttributes.Builder().setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
        .setLegacyStreamType(AudioManager.STREAM_RING)
        .setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE).build();
mChannel.setSound(notificationSound, attributes);
mChannel.setVibrationPattern(new long[]{0, 700, 500, 700});
mChannel.enableVibration(true);
mChannel.enableLights(true);

mNotificationManager.createNotificationChannel(mChannel);

When i check notification channel created on device, the channel is created successfully, but when I open Notification setting from app settings, the notification sound is disabled.

In other devices the notification channel is correctly created and sound is enabled.

Someone know how solve this problem?

Thanks
 
Back
Top Bottom