1
0
mirror of https://github.com/danog/termux-api.git synced 2024-11-26 20:04:42 +01:00

Hack to make led work without vibrating

It seems that led coloring does not work without vibration. So if
the led color has been specified but not vibration, default to a
dummy vibrate={0}.
This commit is contained in:
Fredrik Fornwall 2017-01-10 00:39:52 +01:00
parent 25e6f00bef
commit 3d2ff5fe60

View File

@ -71,7 +71,14 @@ public class NotificationAPI {
notification.setPriority(priority);
notification.setWhen(System.currentTimeMillis());
if (ledColor != 0) notification.setLights(ledColor, ledOnMs, ledOffMs);
if (ledColor != 0) {
notification.setLights(ledColor, ledOnMs, ledOffMs);
if (vibratePattern == null) {
// Hack to make led work without vibrating.
vibratePattern = new long[]{0};
}
}
if (vibratePattern != null) {
// Do not force the user to specify a delay first element, let it be 0.