Home » Java » How to add fcm notification sound in app side

How to add fcm notification sound in app side

Posted by: admin October 26, 2017 Leave a comment

Questions:

now my notification sounds are in server side

{
"to" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
   "data" : {
 "Nick" : "Mario",
 "body" : "great match!",
 "Room" : "PortugalVSDenmark"
},
}

How to change it in app side (Locally java program for android or swift program for IOs)

Answers:
 Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification);
        r.play();

put this code , when you want to play sound