almo
almo

Reputation: 6367

Where to put custom sound file for push notifications in Ionic 2 for Android

I am using the push plugin in my Ionic 2 app. Now I want to use a custom sound file.

I am sending the file name in my payload:

options = {data: {title: "Title", body: 'Body.', soundname: 'soundfile'}}

But now I don't know where to put the sound file in my Ionic project.

I am supposed to put it into res/raw. But is this inside my platform folder? Can someone tell me the correct path starting from the root directory?

Upvotes: 6

Views: 3382

Answers (2)

Swatantra Mukherjee
Swatantra Mukherjee

Reputation: 11

platforms/android/res/raw/ path not found ionic3. What to do? Shall I have to create manually?

Upvotes: 0

almo
almo

Reputation: 6367

I found the answer:

You have to put it in:

platforms/android/res/raw/filename.mp3

For iOS I put it here:

platforms/ios/res/raw/filename.mp3

In your options it's important that you inform the filename WITHOUT the filetype:

options = {data: {title: "Title", body: 'Body.', soundname: 'filename'}}

Upvotes: 3

Related Questions