damonkashu
damonkashu

Reputation: 1823

is the vibration for call setting accessible in android?

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

Answers (2)

JPM
JPM

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

  1. Always
  2. Never
  3. Only in Silent Mode
  4. Not in Silent Mode

Upvotes: 1

apps
apps

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

Related Questions