Reputation: 1823
Is there a way I can access the system preference for vibration settings?
I have an alarm-like app which I want to inherit the vibration setting from the phone's ring/sound settings. However, I do not know how to programmatically access these settings.
Upvotes: 2
Views: 1314
Reputation: 9296
I am currently using the AudioManager. The suggestions I saw around for getRingerMode() do not work for proper vibration setting detection.
AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
boolean vibrate = am.shouldVibrate(AudioManager.VIBRATE_TYPE_RINGER);
Wish there was a way to get the actual setting which on my phone has 4 different modes
Upvotes: 1
Reputation: 942
To get the settings for the vibration use: getVibrateSetting which may or may not require the permission
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
Try first without the permission.
Upvotes: 0