I've used FCM Notifications in My app , I'm Receiving Them and it's showing Title And message Perfectly
But,When i'm receiving the Notification Im not getting any sound or vibration or any Led light indication
My Notification Builder Code is
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setSmallIcon(R.drawable.applogo);
builder.setContentTitle(Title);
builder.setContentText(Message);
builder.setAutoCancel(true);
builder.setSound(Uri.parse("file:///android_asset/notification.mp3"));
builder.setContentIntent(pendingIntent);
builder.setDefaults(Notification.DEFAULT_VIBRATE);
builder.setLights(Color.RED, 1000, 300);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, builder.build());
Thanks in Advance.
Try these steps: Go to Settings > Sound & Notification > App Notifications. Select the app, and make sure that Notifications are turned on and set to Normal. Make sure that Do Not Disturb is turned off.
Check and Increase Notification Volume Level Even if your ringtone volume is high, it wouldn't matter if notification volume is low. So you must check the notification volume level separately. To do so, go to Settings > Sounds and vibration > Volume. Increase the slider next to Notifications by moving it to right.
Open your phone's Settings app. Notifications. Under "Lock screen," tap Notifications on lock screen or On lock screen. Choose Show alerting and silent notifications.
Check Notification Settings of Messages App You can check notification settings from System Settings > Apps and Notifications > Apps > Messages. Then click on the Notifications option and make sure All Messages notifications is toggled on. Also, Android supports multiple channels for notifications.
firebase
make sure that sound option enabledlike this
<uses-permission android:name="android.permission.VIBRATE" />
notification payload of the notification there is a sound key.
From the official documentation its use is:
Indicates a sound to play when the device receives a notification. Supports default or the filename of a sound resource bundled in the app. Sound files must reside in /res/raw/.
{
"to" : ".......",
"notification" : {
"body" : "body",
"title" : "title",
"icon" : "myicon",
"sound" : "default"
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With