How to check if device vibration mode is set or not in iOS software?

I am making a VoIP application for iOS. For incoming calls, I set some custom ringtones. It works fine, but I want to check if the device’s settings in vibration mode are set or not programmatically.

I searched the Internet for this problem, but I found the answers only to detect silent mode. Instead, I want to check if the device is in vibration mode or not.

When an incoming call arrives in my application, I want to use vibration mode if the device settings are set to vibration mode.

Can anyone help me?

+7
ios objective-c iphone-vibrate
source share
1 answer

At first, it seems that none of the Audio Session properties allows you to read the value of this parameter. However, an alternative, though not quite what you are looking for, is to check if the ring is set to on / off and to provide at least a semi-visible vibration effect for your user.

Ronak Chaniyar has shown you the correct answer here , however this is not recommended in iOS 7.0. Instead, use AVAudiSession -setCategory to set the correct category for your audio. If you expect your sound to be muted with a quiet switch or screen lock, use AVAudioSessionCategorySoloAmbient , otherwise use AVAudioSessionCategoryPlayback .

More information about AVAudioSession, its settings and properties can be found here .

0
source share

All Articles