Cannot disable notification vibration in Android 8

前端 未结 5 890
失恋的感觉
失恋的感觉 2021-02-14 18:54

I try to disable vibration when showing a notification.

Func:

public static Notification buildNotifForUploaderService(Context ctx, String          


        
5条回答
  •  迷失自我
    2021-02-14 19:19

    Like this answer, do:

    mNotificationChannel.setVibrationPattern(new long[]{ 0 }); 
    mNotificationChannel.enableVibration(true);
    

    Important 1: even if I set the vibration pattern above, but set enableVibration to false, it vibrates. So, set enableVibration to true!

    Important 2: like this another answer, the channel keeps its initial settings, so uninstall and install the app again to apply the changes!

    Hope it helps!

提交回复
热议问题