Added send notification channel

pull/156/head
M66B 6 years ago
parent 2827e8abeb
commit 4578065562

@ -281,25 +281,29 @@ public class ApplicationEx extends Application {
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
NotificationChannel service = new NotificationChannel( NotificationChannel service = new NotificationChannel(
"service", "service", getString(R.string.channel_service),
getString(R.string.channel_service),
NotificationManager.IMPORTANCE_MIN); NotificationManager.IMPORTANCE_MIN);
service.setSound(null, Notification.AUDIO_ATTRIBUTES_DEFAULT); service.setSound(null, Notification.AUDIO_ATTRIBUTES_DEFAULT);
service.setShowBadge(false); service.setShowBadge(false);
service.setLockscreenVisibility(Notification.VISIBILITY_SECRET); service.setLockscreenVisibility(Notification.VISIBILITY_SECRET);
nm.createNotificationChannel(service); nm.createNotificationChannel(service);
NotificationChannel send = new NotificationChannel(
"send", getString(R.string.channel_send),
NotificationManager.IMPORTANCE_HIGH);
send.setSound(null, Notification.AUDIO_ATTRIBUTES_DEFAULT);
send.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
nm.createNotificationChannel(send);
NotificationChannel notification = new NotificationChannel( NotificationChannel notification = new NotificationChannel(
"notification", "notification", getString(R.string.channel_notification),
getString(R.string.channel_notification),
NotificationManager.IMPORTANCE_HIGH); NotificationManager.IMPORTANCE_HIGH);
notification.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE); notification.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
notification.enableLights(true); notification.enableLights(true);
nm.createNotificationChannel(notification); nm.createNotificationChannel(notification);
NotificationChannel warning = new NotificationChannel( NotificationChannel warning = new NotificationChannel(
"warning", "warning", getString(R.string.channel_warning),
getString(R.string.channel_warning),
NotificationManager.IMPORTANCE_HIGH); NotificationManager.IMPORTANCE_HIGH);
warning.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE); warning.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
nm.createNotificationChannel(warning); nm.createNotificationChannel(warning);

@ -126,7 +126,7 @@ public class ServiceSend extends LifecycleService {
PendingIntent pi = PendingIntent.getActivity( PendingIntent pi = PendingIntent.getActivity(
this, ActivityView.REQUEST_OUTBOX, intent, PendingIntent.FLAG_UPDATE_CURRENT); this, ActivityView.REQUEST_OUTBOX, intent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "service"); NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "send");
builder builder
.setSmallIcon(R.drawable.baseline_send_24) .setSmallIcon(R.drawable.baseline_send_24)

@ -9,6 +9,7 @@
<string name="app_crash">FairEmail is not supported on this device because bugs in Android cause crashes</string> <string name="app_crash">FairEmail is not supported on this device because bugs in Android cause crashes</string>
<string name="channel_service">Service</string> <string name="channel_service">Service</string>
<string name="channel_send">Send</string>
<string name="channel_notification">Notifications</string> <string name="channel_notification">Notifications</string>
<string name="channel_warning">Warnings</string> <string name="channel_warning">Warnings</string>
<string name="channel_error">Errors</string> <string name="channel_error">Errors</string>

Loading…
Cancel
Save