以编程方式将 android 中的通知振动强度降低为零 [英] Reduce Notification vibration intensity to zero in android programatically

查看:37
本文介绍了以编程方式将 android 中的通知振动强度降低为零的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我想在收到通知时关闭振动.我可以将通知声音静音,但无法停止振动.

In my application, I want turn off the vibration when notification comes. I am able to mute the sound of notification but not able to stop the vibration.

为了使通知静音,我使用了以下代码:

To mute the sound of notification, I have used following code:

 if (audioManager.getStreamVolume(AudioManager.STREAM_NOTIFICATION) != value) {
        audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, value, 0);
        Utils.log("Volume Changed to " + value);
    }

请建议如何将通知振动强度更改为零或建议其他方法在通知到达时取消振动.

Please suggest how to change the notification vibration intensity to zero or suggest some other way to cancel vibration when notification arrives.

audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION,
        AudioManager.VIBRATE_SETTING_OFF);

setVibrateSetting 不起作用且已弃用

setVibrateSetting is not working and is deprecated

我可以通过以下方式手动更改三星设备中通知的振动强度:

I can manually change vibration intensity of notification in Samsung devices by:

  1. 进入设置
  2. 转到我的设备"标签
  3. 点击声音并打开振动强度"
  4. 选择来电、通知和触觉反馈的振动强度

但是我怎样才能以编程方式做到这一点?请帮忙.

But how can I do it programatically? please help.

推荐答案

这个问题的唯一解决方案是保持静音模式.在最新版本的 Android 中,我们无法关闭默认振动.

The only solution to this problem is to keep the silent mode on. In the latest versions of Android we cannot turn off the default vibration.

这篇关于以编程方式将 android 中的通知振动强度降低为零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆