I have implemented Push Notification and have been using Default sounds every time. I know that there are many other sounds as well that I can use but I don't know the names of all sounds that Apple support for Push Notification. Can someone please help me to get the list?
Thanks.
You could put your own sound file , which you like to play.
From apple documentation.
You can package the audio data in an
aiff, wav, or caf file. Then, in
Xcode, add the sound file to your
project as a nonlocalized resource of
the application bundle.
See more
The sound has to be bundled with your app.
You can use any sound you desire (and you have the rights to) - but you need to correctly encode the sound to work on the device (caf, aiff, wav). You must embed the sound as a resource within your project bundle, you cannot use "Any sound" on the device. Once embedded, you can reference it by filename in your payload for the sound.
Caveat - your sound must be under 30 seconds long and there is no mechanism to loop the sound)
Apple Push Documentation
Related
I'd like to record what the iPhone is currently outputting. So I'm thinking about recording audio from Apps like Music (iPod), Skype, any Radio Streaming App, Phone, Instacast... I don't want to record my own audio or the mic input.
Is there an official way to do this? How do I do it? It seems like AVAudioRecorder does not allow this, can somebody confirm?
Officially you can't. The audio stream belongs to the app playing it ,and iOS.
The Sandbox paradigm means that a resource owned by your App can't be used by another App. Resource here means Audio/Video stream or file. Exceptions are when a mediator like Document interaction controller are used.
If you want to do this you'd have to start with deducing AVFoundation's private methods and find out if theres a way there. Needless to say this it wouldn't be saleable on the App store and will probably only be possible on a jailbreak.
Good Luck.
TLDR;
This is only feasible only from time to time, as it's a time expensive process.
You can record the screen while listening your songs on Spotify, Music or whatever music application.
This will generate a video on your Photos application. That video can be converted on MP3 from your computer.
Actually, this is not true. The screen recordings will not actually have the audio from Apple Music at all, as it blocks it. Discord also uses this pipe as well, so you cannot record Discord audio either this way.
I implemented local notification in my app but I am just wondering is there a way to play a sound that is not part of the NSMainbundle.Basically in my app, I want user to record a sound that gets played when the local notification is generated instead of playing a pre-recorded sound. I have read out the Apple Documentation but i have also seen 2 -3 Apps on app store which is doing it like the this App link of the App i am wondering how the are playing custom sounds (sounds which are not the part of NSMainBundel)
Anyone has any idea how I can do it ?
Thank you in Advance
What you can do is to utilize the AVAudioRecorder and save its recordings to the documents directory of the iPhone.
After the recording is done, you can play the very same files using an AVAudioPlayer via the path of the recorded files.
HTH
Within my iOS application, how can I play a sound file stored in the application's documents directory for a local notification, rather than one inside the application bundle?
I've seen a couple of applications on the App Store do this, and I was wondering how this is possible.
It is actually possible to play a custom sound in a local notification that isn't in the app's main bundle (NSBundle).
The sound has to be stored in the Library/Sounds directory, for example:
/var/mobile/Containers/Data/Application/DD7E6BA0-2FC0-4DE0-95BF-C2E9C9A94E08/Library/Sounds/mySound.caf
When you reference the sound file in the UILocalNotification soundName property, you simply write the filename, rather than the full directory path:
alert.soundName = #"mySound.caf";
Tested and working on iOS9.3.5. I haven't tried on other iOS versions yet.
Footnote:
I happened to find this information when searching the Apple Documentation regarding Remote Notifications Here - Specifically, the 'Payload Keys' section, where it mentions sound.
Apple's documentation for Local & Remote Notifications (Here) also mentions that the sound files can be utilised if they are in the app's main bundle OR the data container:
To play a sound, assign a sound to the soundName property. You can assign the filename of a nonlocalized custom sound in the app’s main bundle (or data container) or you can assign UILocalNotificationDefaultSoundName to get the default system sound. A sound should always accompany the display of an alert message or the badging of an icon; a sound should not be played in the absence of other notification types.
No you can not play an audio file that is not in the bundle and you can not modify the application bundle at runtime. One reason why Apple requires all sounds for local notifications to be bundled with the application may be for security reasons, that would make it possible for all bundled files to be checked for security risks during the review process.
Exactly .....
You can not play audio file stored in document directory for alarm as a local push notification.
I also had gone through various apps on app store .those apps basically look like playing customise audio from document directory for local push notification but it is not .insted it using push notification and when notification come at that time when we click on view button of that notification the app which generated the local push notification will get invoked and finally the selected audio file get played .
In this way the app is look like customized push notification using customized audio file from document directory
I am building an application in which I have to include an Alarm. In this scenario, I am not getting on which frame should I rely on. Adding, I need to play default audio file as recorded one. How can I play default audio files?? Please help me in this regard..
Thanks in advance.
What you want is a local sound notification. You can go through this tutorial.
Also note that you can not use any sounds not provided within your application. Here is a extract from the docs:
For this property, specify the filename (including extension) of a sound resource in the application’s main bundle or UILocalNotificationDefaultSoundName to request the default system sound.
I have used Local Notification in my app an successfully generated an alert at correct time..
But when i tried following code for playing sound it does not play....
localNot.soundName =#"Ghulam Ali-Chamkte Chaad Ko.mp3";
Can anyone tell me the reason....Does the playing length of sound file affects
According to the Apple Developer Documentation, you need to use "aiff", "caf" or "wav" files.
The link provided shows some ways of converting audio to these formats on your mac.