How to programmatically play a default sound tune?

I am working on a conference related application. I want to show a call notification for an incoming call. I tried with AVAudioPlayer and it worked great for custom sounds. My question is, can I get the default ringtone from iPhone (user tone in settings) and play it for my application?

Thanks for your valuable suggestions ...

+8
source share
3 answers

No, there is no API SDK for receiving ringtones for iPhone.

But you can download them from other links and add to your project

+4
source

Someone asked a similar question here , but overall this is not possible, at least if you want to distribute your application through the App Store. On a jailbreak phone, you may find this answer helpful.

+5
source

The recommended way is to use CallKit. Your VoIP application will then receive many things โ€œfor free.โ€ When you enter an incoming call using CallKit, iOS automatically plays the correct ringtone.

https://developer.apple.com/documentation/callkit

There are many things that CallKit handles for you. Things like:

  • displaying the correct incoming call screen when the phone is locked
  • what happens if the user is already on another call
  • Do Not Disturb Enabled (either driving or in sleep mode)
  • the phone is disconnected
  • plays the right tune
0
source

Source: https://habr.com/ru/post/926182/


All Articles