【问题标题】:Why VIBRATOR_SERVICE is not working consistently?为什么 VIBRATOR_SERVICE 无法始终如一地工作?
【发布时间】:2015-01-05 19:50:02
【问题描述】:

我有 2 部手机:一部是 Android 4.1.1,另一部是 Android 4.1.2。

在 Android 4.1.1 手机上,振动强度取决于触觉反馈水平,而 4.1.2 手机振动很强,完全不依赖于触觉反馈水平。

我一直在想办法解决它,但我就是无法理解。我真的不希望振动强度依赖于触觉反馈,因为有些用户不喜欢打开这种触觉反馈。

谁能解释一下?

代码如下:

 import android.os.Vibrator;
 ...
 Vibrator v = (Vibrator) this.context.getSystemService(Context.VIBRATOR_SERVICE);
 // Vibrate for 500 milliseconds
 v.vibrate(500);

清单:

<uses-permission android:name="android.permission.VIBRATE"/>

非常感谢

【问题讨论】:

    标签: android android-vibration


    【解决方案1】:
    Vibrator v = (Vibrator)getApplicationContext().getSystemService(getApplicationContext().VIBRATOR_SERVICE);
    

    【讨论】:

    • 感谢您的评论。我之前尝试过这段代码,没有任何区别:结果相同。
    【解决方案2】:

    你所做的是正确的。确保: 在设置下,查找“振动强度”并确保“通知”未设置为关闭。

    这对我有用!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-10
      • 1970-01-01
      • 1970-01-01
      • 2018-05-29
      相关资源
      最近更新 更多