Skip to main content
replaced http://android.stackexchange.com/ with https://android.stackexchange.com/
Source Link

TL;DR

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 commentdbasch mentioned in the comment, that the vibration (actually, the notification alert itself) was added in Marshmallow.


#Technical Details

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 ConnectivityService.

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 SIGN_IN.

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)
    ...

Note that 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.

TL;DR

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.


#Technical Details

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 ConnectivityService.

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 SIGN_IN.

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)
    ...

Note that 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.

TL;DR

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.


#Technical Details

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 ConnectivityService.

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 SIGN_IN.

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)
    ...

Note that 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.

Source Link
Andrew T.
  • 16.5k
  • 10
  • 76
  • 127

TL;DR

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.


#Technical Details

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 ConnectivityService.

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 SIGN_IN.

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)
    ...

Note that 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.