Since the Android 6.0 update on Nexus 5, everytime I get the notification 'Sign in to WiFi network' the phone vibrates. Any idea where I can turn this off while keeping the vibration for calls, SMS, WhatsApp messages, etc.?
There is a workaround involving Do not disturb's Priority only mode.
To put it simply, you must use Priority only (from Quick Settings - Do not disturb) since it has per-app setting for notification alert that can overwrite system's default setting. Priority only mode will still show all notifications. However, only priority notifications will be alerted (sound, vibration and LED light).
The idea is to treat all notifications as priority (from Settings - Sound & notification - App notifications - [app name] - Treat as priority) except for captive portal notification, which is under Android System app (by default, system apps are not listed. You need to tick Show system from overflow menu. Leave this app as non-priority, but don't forget for the rest of system apps).
However, there are some disadvantages that you might consider first before using this workaround:
- You sacrifice the intended usage of Priority only mode, only leave Total silence as the only option (however, if you never intend to use this feature, then you're fortunate since you can utilize it).
- If you have many apps installed, it's quite tedious to set all apps to treat their notifications as priority (perhaps a script might help...). Also, every time you install a new app, you must not forget to treat its notification as priority (unless you don't care about its alert).
- You won't get any alerts for all notifications from Android System (you need to experiment with this, since I don't know what notifications are considered by Android System).
If you still want to have vibration on all notifications except for captive portal (this particular issue), I'm afraid you can't.
It's as dbasch mentioned in the comment, that the vibration (actually, the notification alert itself) was added in Marshmallow.
When Android detects that the WiFi needs to login to captive portal, as you already noticed, it will create a notification. It's done by
setProvNotificationVisibleIntent() function in
Show or hide network provisioning notifications.
We use notifications for two purposes: to notify that a network requires sign in (
NotificationType.SIGN_IN), or to notify that a network does not have Internet access (
NotificationType.NO_INTERNET). We display at most one notification per ID, so on a particular network we can display the notification type that was most recently requested. So for example if a captive portal fails to reply within a few seconds of connecting, we might first display
NO_INTERNET, and then when the captive portal check completes, display
The relevant code to the notification alert that is used in Android 6.0 Marshmallow:
Notification notification = new Notification.Builder(mContext) ... .setDefaults(Notification.DEFAULT_ALL) ...
Notification.DEFAULT_ALL will "use all default values (where applicable)", which means that it depends on your system's notification setting (sound, vibration, and LED light).
Compared to the one in Android 5.x Lollipop, the code is:
Notification notification = new Notification(); ...
No more, no less. That's the relevant code.
new Notification() will "construct a
Notification object with default values". While it seems that there's no change in the meaning, note that
defaults is not set/initialized to
Notification.DEFAULT_ALL (value: -1). Instead, since there's no initialization, it will be defaulted to 0, which is no alert.
Whether it's a bug overlooked by Google which has been fixed in Marshmallow or not, I don't know. Also, that's the reason why there's no alert in Android Lollipop, but now there is in Android Marshmallow.
Only way I found to get rid of that annoying vibration is to disable completely the 'available wifi' notification. To do it go to setting-> wifi -> tap on the three vertical dots -> go to 'advanced settings' and disable the notifications for publicly accessible wifi networks. Waiting for a fix, I think it is the only solution and not so bad a loss to disable them, I always thought them useless enough.
Settings > Apps > Google Connectivity Services > Notifications > Block turns them off entirely.
That notification is initiated by Android System (
android). You can use appops to deny Android System the permission to vibrate the device in any situation. Provided that you've adb setup in PC, do:
adb shell appops set android VIBRATE deny
Try connecting to a Wi-Fi with no internet access. You would still get that notification but with no vibration. If you also intend to hide that notification, you may follow the rest of the answers posted here or on this website.
To revert the changes, do:
adb shell appops set android VIBRATE allow
Vibration for calling is initiated by Dialer app, for SMS it would be your default SMS app, for WhatsApp messages, it is the same app, so they are not going to be affected. There may be unforeseen consequences of that command which I'm unaware of, so let me know about them through comments.
Note: this solution is tested on an unofficial CM13 build.