From a06e5119735d5758d054128fda1221c0f977e5dc Mon Sep 17 00:00:00 2001 From: greenart7c3 Date: Fri, 16 Feb 2024 10:18:17 -0300 Subject: [PATCH] hide the notification by default --- .../com/greenart7c3/citrine/WebSocketServerService.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/greenart7c3/citrine/WebSocketServerService.kt b/app/src/main/java/com/greenart7c3/citrine/WebSocketServerService.kt index b0a969d..03bcac0 100644 --- a/app/src/main/java/com/greenart7c3/citrine/WebSocketServerService.kt +++ b/app/src/main/java/com/greenart7c3/citrine/WebSocketServerService.kt @@ -76,7 +76,11 @@ class WebSocketServerService : Service() { private fun createNotification(): Notification { val channelId = "WebSocketServerServiceChannel" - val channel = NotificationChannel(channelId, "WebSocket Server", NotificationManager.IMPORTANCE_DEFAULT) + val channel = NotificationChannel( + channelId, + "WebSocket Server", + NotificationManager.IMPORTANCE_UNSPECIFIED + ) channel.setSound(null, null) val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager notificationManager.createNotificationChannel(channel) @@ -96,7 +100,8 @@ class WebSocketServerService : Service() { val notificationBuilder = NotificationCompat.Builder(this, "WebSocketServerServiceChannel") .setContentTitle("Relay running at ws://localhost:${webSocketServer.port()}") .setSmallIcon(R.mipmap.ic_launcher) - .setPriority(NotificationCompat.PRIORITY_DEFAULT) + .setPriority(NotificationCompat.PRIORITY_MIN) + .setCategory(NotificationCompat.CATEGORY_SERVICE) .addAction(R.drawable.ic_launcher_background, "Copy Address", piCopy) .setContentIntent(resultPendingIntent)