[LOCAL NOTIFICATION PLUGIN] how to use a custom sound

I tried differents ways to use the Notification.sound in Local Notification Plugin and nothing worked.

How to put a custom sound?

what format can it be?


there is any documentation????

Hi Rai

The documentation for the plugin can be found here.

Regarding having a custom sound, this plugin is a wrapper for
cordova-plugin-local-notifications. It means that you could try to do a few tweaks in order to achieve what you want. 

I did a quick search on this and I found a few topics about this. Take a look and see if it helps.

https://github.com/katzer/cordova-plugin-local-notifications/issues/104

https://github.com/katzer/cordova-plugin-local-notifications/issues/1414

Vera

My problem, I think, is to use something from resources.

I already tried several times and now I'm having the same issue, but in other plugin.


I uploaded one archive to resource, put the deploy action and a target directory (target directory = Documents). 



How I can access it?

I tried:

"/AppName/Documents/file.extension"

"AppName/Documents/file.extension"

"/Documents/file.extension"

"Documents/file.extension"

"Documents\file.extension"

Resources.file_extension.URL


nothing work...






Solution

Quite a search and effort.

For iOS:


1. Make sure your audio file is in .caf format. Convert if necessary.

2. Sound should be shorter than 30 seconds.

3. When you upload the file as a resource, make sure you chose the option to “deploy to target”.

4. For the sound parameter passed into the plugin, use: file://filename.caf, assuming the file is deployed under the resource root.

5. You may need to regenerate the app and reinstall on your device.


These steps worked for me on iOS devices.

Solution

Denis Mulder wrote:

Quite a search and effort.

For iOS:


1. Make sure your audio file is in .caf format. Convert if necessary.

2. Sound should be shorter than 30 seconds.

3. When you upload the file as a resource, make sure you chose the option to “deploy to target”.

4. For the sound parameter passed into the plugin, use: file://filename.caf, assuming the file is deployed under the resource root.

5. You may need to regenerate the app and reinstall on your device.


These steps worked for me on iOS devices.

HI 


How did you configure sounds for android, as it works only for ios but not for android.


Regards,

Anahit


Hi Anahit,

Unfortunately, I focused on iOS only and have not tried Android yet. Let us know how you did it if you find a solution.


Thanks,


Denis.