From 0c0d7d181f0973c52338a35c6acc5e9767dac7fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Fri, 23 Nov 2018 18:48:25 +0100 Subject: [PATCH] enable light in notification channel (android-oreo) + shorter vibrate --- .../simplecloudnotifier/SCNApp.java | 2 -- .../service/NotificationService.java | 16 ++++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/SCNApp.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/SCNApp.java index 8343b21..9199bf6 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/SCNApp.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/SCNApp.java @@ -100,5 +100,3 @@ public class SCNApp extends Application implements LifecycleObserver } //TODO TabLayout indicator does not correctly animate when directly clicking on tabs -//TODO Vibrate is a single long and not two short ? -//TODO Crash (see report) \ No newline at end of file diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/service/NotificationService.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/service/NotificationService.java index d45157a..5c8b64f 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/service/NotificationService.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/service/NotificationService.java @@ -65,7 +65,8 @@ public class NotificationService channel0.setDescription("Push notifications from the server with low priority.\nGo to the in-app settings to configure ringtone, volume and vibrations"); channel0.setSound(null, null); channel0.setVibrationPattern(null); - channel0.setLightColor(Color.BLUE); + channel0.setLightColor(Color.CYAN); + channel0.enableLights(true); notifman.createNotificationChannel(channel0); } } @@ -77,7 +78,8 @@ public class NotificationService channel1.setDescription("Push notifications from the server with low priority.\nGo to the in-app settings to configure ringtone, volume and vibrations"); channel1.setSound(null, null); channel1.setVibrationPattern(null); - channel1.setLightColor(Color.BLUE); + channel1.setLightColor(Color.CYAN); + channel1.enableLights(true); notifman.createNotificationChannel(channel1); } } @@ -89,7 +91,9 @@ public class NotificationService channel2.setDescription("Push notifications from the server with low priority.\nGo to the in-app settings to configure ringtone, volume and vibrations"); channel2.setSound(null, null); channel2.setVibrationPattern(null); - channel2.setLightColor(Color.BLUE); + channel2.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE); + channel2.setLightColor(Color.CYAN); + channel2.enableLights(true); notifman.createNotificationChannel(channel2); } } @@ -115,9 +119,9 @@ public class NotificationService { Vibrator v = (Vibrator) SCNApp.getContext().getSystemService(Context.VIBRATOR_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - v.vibrate(VibrationEffect.createOneShot(1500, VibrationEffect.DEFAULT_AMPLITUDE)); + v.vibrate(VibrationEffect.createOneShot(500, VibrationEffect.DEFAULT_AMPLITUDE)); } else { - v.vibrate(1500); + v.vibrate(500); } } } @@ -254,7 +258,7 @@ public class NotificationService if (ns.EnableVibration) { Vibrator v = (Vibrator) SCNApp.getContext().getSystemService(Context.VIBRATOR_SERVICE); - v.vibrate(VibrationEffect.createOneShot(1500, VibrationEffect.DEFAULT_AMPLITUDE)); + v.vibrate(VibrationEffect.createOneShot(500, VibrationEffect.DEFAULT_AMPLITUDE)); } //if (ns.EnableLED) { } // no LED in Android-O -- configure via Channel