Search code examples
iosflutterdartpush-notificationflutter-dependencies

Change notification sound in iOS Flutter


I want to use my own sound in push notification in iOS platform of Flutter. Since I have no experience in iOS development, I am struggling with it.

In my app settings there are 3 notification sound options, so that user can choose notification sound. I have already implemented local_notifications package and although I am getting notifications in my app, I couldn't find how to use custom sound in push notification for iOS platform.


Solution

  • You should replace this default given sound name to your sound name.

    var iOSPlatformChannelSpecifics = IOSNotificationDetails(sound: 'slow_spring_board.aiff'); //put your own sound text here 
    

    (Before this, your sounds should be added to your project using Xcode) Here is the link to how to add custom sound to your project for iOS devices using Xcode: https://medium.com/@dmennis/the-3-ps-to-custom-alert-sounds-in-ios-push-notifications-9ea2a2956c11

    Note: Sound duration should be less than 30 seconds and the file name should not contain capital letters otherwise it will not work