One of my Android apps does this, which works:
Code: Select all
put specialFolderPath("engine") & "/snds/" & pSndName & ".mp3" into tPath
play tPath
The sound files are in a folder named "snds" which is specified in the Copy Files pane of the standalone builder. The path that is built in the first line of this example points to that.
Sounds will only play if they are in a format the device recognizes. Not all Android devices recognize the same formats. My ancient Archos tablet understood a dozen different file types but my Samsung and Nexus do not. Virtually all devices know about mp3 though, so save your sounds that way.
Edit: Oops, I see you want a sound channel. You might not need one unless you want to play multiple sounds at the same time. But to use a sound channel, do it this way:
mobilePlaySoundOnChannel tPath, "channel1", "now"
The "channel1" parameter is any name you choose that identifies a particular channel. You name them as you go along so that if you want to play another sound on the same channel later, or queue up a couple of sounds, you have a channel name to refer to.
If you're only playing a single sound at a time, you can use my first example.