-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom notification sound in android and ios #61
Conversation
Add custom notification sound when initializing the library as below: Android: @param soundUri - Custom Notification sound, uri should be converted to String. Default value is null, if null default notification sound will be played. For custom notification sound put notification sound in res/raw directory. See how it is used in sample app: 3708ea8 val customNotificationSound =
Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + "com.mmk.kmpnotifier.sample" + "/" + R.raw.custom_notification_sound)
NotifierManager.initialize(
configuration = NotificationPlatformConfiguration.Android(
notificationIconResId = R.drawable.ic_launcher_foreground,
showPushNotification = true,
notificationChannelData = NotificationPlatformConfiguration.Android.NotificationChannelData(
soundUri = customNotificationSound.toString()
)
)
)
iOS: @param notificationSoundName - Custom notification sound name. Default value is null. If set null, default notification sound will be played. For cusotm notification sound, place the file in the Resources directory of your iOS target. Ensure the file is added to your target's "Build Phases" under "Copy Bundle Resources". See how it is used in sample app: 4b2a90d NotifierManager.initialize(
NotificationPlatformConfiguration.Ios(
showPushNotification = true,
askNotificationPermissionOnStart = true,
notificationSoundName = "custom_notification_sound.wav"
)
)
|
Is it working for push notifications too or only for simple notifications? |
In my case it works only for simple notifications (IOs)... not from push!! Probably i miss something... this calls for a new investigation 🧐 after the investigation 😅 this is the right fcm payload - in this case also with IOs (PUSH notification) works.
or
@mirzemehdi thanks 4 y job! |
Solves #34