Android notificationcompat sound/vibration not working
Question: I've spent my last 2 hours trying to figure our why my notification sent from
FireBase doesn't make any sound or vibration.

I have looked on many topics about this problem and tried different
combinations with `.setDefaults` `.setVibrate(new long[] { 1000, 1000, 1000,
1000, 1000 })` `.setSound(defaultSoundUri)`

What I have right now is this:

    
    
        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 notificationBuilder = new NotificationCompat.Builder(this)
                .setSmallIcon(R.mipmap.ic_launcher)
                .setContentTitle("Firebase Push Notification")
                .setContentText(messageBody)
                .setAutoCancel(true)
                .setPriority(Notification.PRIORITY_MAX)
                .setDefaults(-1)
                .setContentIntent(pendingIntent);
    
        NotificationManager notificationManager =
                (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    
        notificationManager.notify(0, notificationBuilder.build());
    

I don't have any errors and the notification is showing but I repeat, no
sound, no vibration, no led lights, no heads-up.

To send the notification I use a python library on my server:

    
    
    # Send to single device.
    from pyfcm import FCMNotification
    
    push_service = FCMNotification(api_key="xxxxxxxxxxxxxxxx")
    
    registration_id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    message_title = "Test"
    message_body = "Test notification"
    result = push_service.notify_single_device(registration_id=registration_id, message_title=message_title, message_body=message_body)
    
    print result
    

Note: I already have in manifest defined permission: `<uses-permission
android:name="android.permission.VIBRATE" />` Any ideea ?


Answer: **You aren't sending sound flag from your server** maybe that's why you aren't
getting notification sound. Please try adding:

    
    
    sound = "default"
    

This will probably get you the sound of notification.

Have a look at this:

<https://firebase.google.com/docs/cloud-messaging/http-server-ref>

for better understanding of fcm downstream android notification flags.

Do let me know if it changes anything for you.

