'Silent Push Notifications

How can we archive silent notification tag in android. We have a service for which we need a silent notificatioin. Current Code

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        val notificationManager =
            getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
        val channel = NotificationChannel(
            "" + Constant.SERVICE_CHANNEL_ID,
            "" + Constant.SERVICE_CHANNEL_NAME,
            NotificationManager.IMPORTANCE_LOW
        ).let {
            it.description = "StarVpn Service channel"
            //it.description = "no sound"
            it.enableLights(false)
            //it.lightColor = Color.RED
            it.enableVibration(false)
            it.vibrationPattern = null
            it.setSound(null, null)
            it.setShowBadge(false)
            it
        }
      
 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source