enable light in notification channel (android-oreo) + shorter vibrate

This commit is contained in:
Mike Schwörer 2018-11-23 18:48:25 +01:00
parent 9304da9422
commit 0c0d7d181f
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 10 additions and 8 deletions

View File

@ -100,5 +100,3 @@ public class SCNApp extends Application implements LifecycleObserver
} }
//TODO TabLayout indicator does not correctly animate when directly clicking on tabs //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)

View File

@ -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.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.setSound(null, null);
channel0.setVibrationPattern(null); channel0.setVibrationPattern(null);
channel0.setLightColor(Color.BLUE); channel0.setLightColor(Color.CYAN);
channel0.enableLights(true);
notifman.createNotificationChannel(channel0); 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.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.setSound(null, null);
channel1.setVibrationPattern(null); channel1.setVibrationPattern(null);
channel1.setLightColor(Color.BLUE); channel1.setLightColor(Color.CYAN);
channel1.enableLights(true);
notifman.createNotificationChannel(channel1); 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.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.setSound(null, null);
channel2.setVibrationPattern(null); channel2.setVibrationPattern(null);
channel2.setLightColor(Color.BLUE); channel2.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
channel2.setLightColor(Color.CYAN);
channel2.enableLights(true);
notifman.createNotificationChannel(channel2); notifman.createNotificationChannel(channel2);
} }
} }
@ -115,9 +119,9 @@ public class NotificationService
{ {
Vibrator v = (Vibrator) SCNApp.getContext().getSystemService(Context.VIBRATOR_SERVICE); Vibrator v = (Vibrator) SCNApp.getContext().getSystemService(Context.VIBRATOR_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 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 { } else {
v.vibrate(1500); v.vibrate(500);
} }
} }
} }
@ -254,7 +258,7 @@ public class NotificationService
if (ns.EnableVibration) if (ns.EnableVibration)
{ {
Vibrator v = (Vibrator) SCNApp.getContext().getSystemService(Context.VIBRATOR_SERVICE); 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 //if (ns.EnableLED) { } // no LED in Android-O -- configure via Channel