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

No sound when receiving push notification

$
0
0

i am using react-native-firebase v6 to handle the push notification. The problem is there is no sound played when the push notification received.

I have create a channel and set it to high priority since the default channel created by react-native-firebase has no sound. Here the code i used in the MainActivity.java

protected void onCreate(Bundle savedInstanceState) {  super.onCreate(savedInstanceState);  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {        NotificationChannel notificationChannel = new NotificationChannel("notifid", "App notification channel", NotificationManager.IMPORTANCE_HIGH);    notificationChannel.setShowBadge(true);    notificationChannel.setDescription("custom notification channel");    notificationChannel.enableVibration(true);    notificationChannel.enableLights(true);    notificationChannel.setVibrationPattern(new long[]{400, 200, 400});    //notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);    NotificationManager manager = getSystemService(NotificationManager.class);    manager.createNotificationChannel(notificationChannel);  }}

And here is the code to change the channel in firebase.json

{"react-native": {"messaging_android_notification_channel_id": "notifid"  }}

But the sound still not playing when the notification received.


Viewing all articles
Browse latest Browse all 29619

Trending Articles



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