Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
Push notification play sounds other than in Bundle
Has anyone worked out a way of getting push notifications to play sounds from a source other than the application bundle? Specifically the applications Documents directory.
My app can create its own sounds and I want the user to be able to assign this sound to be the one used for push notifications. Hence I can't ship pre-installed with the bundle.
I've tried saving files into the bundle within the app, but of course you get permission denied. (On the phone, not in the simulator).
Has anyone worked out a way of getting push notifications to play sounds from a source other than the application bundle? Specifically the applications Documents directory.
My app can create its own sounds and I want the user to be able to assign this sound to be the one used for push notifications. Hence I can't ship pre-installed with the bundle.
I've tried saving files into the bundle within the app, but of course you get permission denied. (On the phone, not in the simulator).
I play simple sounds using the AVAudioPlayer class.
You can create an AVAudioPlayer with the initializer initWithContentsOfURL.
You just need to build a URL that points to a file in your documents directory.
First, get the path to the documents directory, with code like this:
That pretty much confirms my fears - teaches me a lesson in developing loads based on what the simulator did, only to find out the bundle is read only on the phone...
doh! slaps head. again.
Can't see any reason why they couldn't open this up though, to allow the push to play sounds in the apps Documents/ area.
Replies
You can create an AVAudioPlayer with the initializer initWithContentsOfURL.
You just need to build a URL that points to a file in your documents directory.
First, get the path to the documents directory, with code like this:
Then append the filename to that string and turn it into a URL with the NSURL initializer initFileURLWithPath.
Once you've created a sound player, just invoke it from the code that processes your push notification.
Regards,
Duncan C
WareTo
Duncan C
WareTo
Animated GIF created with Face Dancer, available for free in the app store.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeiPhone Dev Center: Apple Push Notification Service Programming Guide: Apple Push Notification Service
Sounds like it needs to be in the bundle.
SlickShopper 2 | BTIConcepts on GitHub | Free NSLog utility | Free Getter Utility | Leave a PayPal donation.
Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | A Model (Object) Is A Beautiful Thing
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeYes, I mean if the app is not running.
That pretty much confirms my fears - teaches me a lesson in developing loads based on what the simulator did, only to find out the bundle is read only on the phone...
doh! slaps head. again.
Can't see any reason why they couldn't open this up though, to allow the push to play sounds in the apps Documents/ area.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome