Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 28468

Notification sound disabled by default for new channel

$
0
0

Notification sound disabled by default when I did below:

Mobile used: Redmi note 7s

For every new channel that I tried creating, I cleared app data, uninstall app and then reinstall app(from USB). And when I tried local notification, it didnt show up with sound. So I checked settings, it says like attached image Screenshot_2019-11-12-13-06-33-807_com android settings

Code I used:

    const channel = new firebase.notifications.Android.Channel(
    'testabc994', 'testabc994', firebase.notifications.Android.Importance.Max)
    .setDescription('All notifications')
    .enableLights(true)
    .enableVibration(true)
    .setLockScreenVisibility(firebase.notifications.Android.Visibility.Public)
    .setSound("default");
    // Create the channel
    firebase.notifications().android.createChannel(channel);

Send notification code:

      const notification = new firebase.notifications.Notification({
        show_in_foreground: true
      })
      .setNotificationId('notificationId')
      .setTitle('My notification title')
      .setBody('My notification body')
      .setSound('default')
      .setData({
        key1: 'value1',
        key2: 'value2',
      });

      notification
        .android.setChannelId('testabc994')
        .android.setSmallIcon('ic_launcher')
        .android.setPriority(firebase.notifications.Android.Priority.High)
        .android.setGroupAlertBehaviour(firebase.notifications.Android.GroupAlert.All)
        .android.setCategory(firebase.notifications.Android.Category.Alarm)

      firebase.notifications().displayNotification(notification);

Android permissions I used in android manifest.xml

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>
<uses-permission android:name="android.permission.VIBRATE" />

Any solution for this?


Viewing all articles
Browse latest Browse all 28468

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>