Play alert sound (same as default message ringtone)
Asked Answered
H

1

12

Is it possible to play some default sounds, such as when an incoming SMS/push is received?

If iOS SDK does not bundle these sound files, where can I download the same sounds?

Hornwort answered 9/3, 2011 at 18:8 Comment(0)
S
27

Yes it is possible, but they use undocumented enum values, that means you should not use it on AppStore apps.

AudioServicesPlaySystemSound(1003);

iOS SDK does not bundle these sound files, but you can find them on the device in the /System/Library/Audio/UISounds/ folder. However, I believe these files are copyrighted.

Why not create a sound yourself?

Shafting answered 9/3, 2011 at 18:21 Comment(4)
I would like to play the exact similar sound, so looking for the easiest way. I have seen a lot of messaging app playing the sound too, and wonder how they do it eg. whatsapp.Hornwort
Just a quick note: On iOS 5, I found that using 1007 gave me the standard Tri-Tone notification sound (same as my push notify sound)Ruelle
Thanks for the good answer. If you're using the sound for debugging purposes, it's easier to just use a simple system beep if one's available, instead of creating your own.Trapp
So there is no way to use a default notification sound without using an undocumented value? If I want to play the user default push notification sound, within my app, is this at all possible?Djakarta

© 2022 - 2024 — McMap. All rights reserved.