Open Nathanielnim opened 2 years ago
权限:
<uses-permission android:name="android.permission.VIBRATE"/>
将下列代码放到您想要实现震动的地方
代码:
Vibrator vibrator = (Vibrator)getSystemService(Service.VIBRATOR_SERVICE);
vibrator.vibrate(50);
权限在之前就已经加过了
您好,您可以排查下Vivo Y32是否有振动器。 tract boolean hasVibrator():判断硬件是否有振动器
有的,这段代码我在其他页面运行过,振动是正常的,在扫描页就不行
您好,请在vibrate方法中打印日志,确认是否调用了vibrate();
方法。
没有调用vibrate()方法就是您存放的位置、场景不对。
之前加过日志也debug看了的,代码是调了的
需求:在扫描或识别成功后调用系统振动以便提示用户操作完成 环境:Vivo Y32、Android 11。使用Customized View Mode方式接入统一扫码服务 相关代码:
振动代码是没问题的,我在其他页面中都是调用成功的