android, unity, onesignal — where to place the sou

2019-04-15 06:36发布

问题:

Saying that I'm new to android development would be an understatement. I'm trying to figure out where to place a sound file in my unity directory such that onesignal, a third party notification server, can access it for this a particular api method:

android_sound: StringOptional Sound file that is included in your app to play instead of the default device notification sound. NOTE: Leave off file extension for Android. Example: "notification"

reference: https://documentation.onesignal.com/reference#create-notification

I get a build error when I place it in res/raw, and anywhere else in the google play services library

Where does it go?

回答1:

You will need to place the OneSignalNotificationRes folder from our Unity Example Project into your Assets/Plugins/Android/ folder. Replace the example icons and sound files with your own.

More details found on the bottom of the 3. Android section in our Unity setup guide.

Thanks.



回答2:

İn Android,

Just move your .mp3 file to

res/raw folder

So your .mp3 file should be shown as src/raw/onesignal_default_sound.mp3

Then build your code and send push.

Also you can user another file names but you have to add Sound File Name while sending push

Enjoy it ^^