У меня есть тема по FCM, и она работает нормально .. проблема в том, как мне установить
пользовательский звук база уведомлений на тема уведомлений ? например
Topic A = hello.mp3
Topic B = merra.mp3
Пример кода
private void sendNotification(String messageBody, Bitmap image, String link) {
Intent intent = new Intent(this, FullscreenActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra("LINK", link);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
PendingIntent.FLAG_ONE_SHOT);
if (FirebaseMessaging.getInstance().subscribeToTopic("topic2"))
customSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
else if (FirebaseMessaging.getInstance().subscribeToTopic("topic1")
customSoundUri = Uri.parse("android.resource://" + getPackageName() + "/raw/sound.mp3");
)
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setLargeIcon(image)/*Notification icon image*/
.setSmallIcon(R.mipmap.ic_launcher_dishroomlogo)
.setContentTitle(messageBody)
.setStyle(new NotificationCompat.BigPictureStyle()
.bigPicture(image))/*Notification with Image*/
.setAutoCancel(true)
.setSound(customSoundUri)
.setContentIntent(pendingIntent);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
}