Create custom sounds and vibrations in iOS? - ios

I've been trying to find information on how you can create custom vibrations in iOS.
Vibrations are easy enough when the application is active. But I want to play a custom vibration (like double vibration) together with a local notification when the application is in the background.
The sound framework only seem to give me sound handle ids while the UILocalNotification wants a sound file name.
Any leads?

Implement the vibration on your own with a timer after you posted your local notification. See also UILocalNotification custom soundName only vibrates phone when alertBody is specified (unlike UILocalNotificationDefaultSoundName)?

Related

How to play user device notification sound in iOS

I am working on app and there I need to play sound when there is FCM notification.
I know I can play custom sound and I can play system sound(iOS). see below for code to play system sound
AudioServicesPlaySystemSound(1003);
I have seen this link and this link but nothing is what I want.
What I want:
I want that When the fcm notification come, I want to play the message/Notification sound that has been selected by user as default notification/message sounds. Also if the device is on silent it should not ring in this condition
NOTE: I know we can send sound name in FCM payload and add similar sound file in bundle But I really want to play sound that has been selected by user.
Please help me. I am right now helpless to play that sound.

Localnotification alert sound in swift

Is it really not possible to let my local notification sound ring when the phone is locked?
I want my local notification give sound even if my phone is locked!
another question i searched alot why my local notification doesn't appear on the lock screen?
If you added the sound permission when requesting then it should have the sound when it comes , even when the screen is locked/Sound Muted it will appear , and here is a tutorial that you can give a try

Play user's selected ringtone or notification sound using AVAudioPlayer

Is it possible play the user's selected ringtone or notification sound using AVAudioPlayer?
I've read we can play systems sounds using AudioServicesPlaySystemSound, like AudioServicesPlaySystemSound(1003), but I really need to play the sounds the user has selected as the ringtone or as notification or alarm sounds.
In Android this is possible using the following:
RingtoneManager.TYPE_ALARM
RingtoneManager.TYPE_NOTIFICATION
RingtoneManager.TYPE_RINGTONE
Is this possible in iOS 10 and above?

Set vibration sound to vibrate on iOS

I'm creating an app where you can "send" vibrations to your contacts.
In IOS how do you set the sound for notifications from my app to vibrate, I want it to vibrate even when silent is off. Also I want the users to send custom vibration patterns, would that work or can you only play a sound once. It should work even when the app is not in background.
Try This Code :
1) AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
2) AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

Can we play sounds in the background at a particular intervals in the iPhone app?

In my app I need to play some sounds like beeps at a particular intervals of time (May not be uniform intervals), even the app is in the background. I have gone through the google and many suggested to use AV Foundation’s AVPlayer. I have gone through the following tutorial also.
http://www.raywenderlich.com/29948/backgrounding-for-ios
This tutorial explains how to play a queue of items.
But in my app there will not be any continuous music. Just we need to play some sounds while the app in foreground or background.
Simply i need to play sounds as RunKeeper does.
Please help me out.
You can try scheduling a local notification and providing a custom sound: https://developer.apple.com/library/ios/documentation/iphone/Reference/UILocalNotification_Class/Reference/Reference.html. This will also display an alert in notification centre / lock screen though.

Resources