check phone settings for haptic feedback

此生再无相见时 提交于 2019-12-08 22:11:48

问题


Is there a way to check if the user has haptic feedback enabled or disabled in their android phone settings? While I think haptic feedback would be useful to my app, I also understand that some people (myself included) generally prefer to have haptic feedback turned off. The closest thing I can find is http://developer.android.com/reference/android/provider/Settings.System.html#HAPTIC_FEEDBACK_ENABLED but I'm not sure if it's what I'm looking for or how to test against it.

thank you in advance for whatever help you can provide.


回答1:


I managed to resolve it. here is the code I used:

mContentResolver = this.getContentResolver();

int val = Settings.System.getInt(mContentResolver,
                 Settings.System.HAPTIC_FEEDBACK_ENABLED, 0);
mSettingEnabled = val != 0;


来源:https://stackoverflow.com/questions/8569398/check-phone-settings-for-haptic-feedback

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!