Notifications are not showing on Android Wear after the recent update (Wear OS 3.5 Samsung Watch 4)

721 views Asked by At

I have problems with receiving the notifications (made by the wear application) on my samsung watch 4 wear os 3.5. My code was working until the recent update; which basically started a Foreground Service with a notification. The service is running, but the notification is not visible. I have no errors. Other than this, normal notifications are not showing neither, made BroadcastReceiver (alarms in every 15 min).

I made a dummy app, which has only one button and generates a notification (nothing special), but it does (or actually does not) the same thing: I can not see the notification.

Steps:

  • create a notification channel
  • toast a text
  • create a notification

Code:

class MainActivity : Activity() {

    private lateinit var binding: ActivityMainBinding
    val CHANNEL_ID = "test1234"

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            // Create the NotificationChannel
            val name = getString(R.string.channel_name)
            val descriptionText = getString(R.string.channel_description)
            val importance = NotificationManager.IMPORTANCE_HIGH

            val mChannel = NotificationChannel(CHANNEL_ID, name, importance)
            mChannel.description = descriptionText
            // Register the channel with the system; you can't change the importance
            // or other notification behaviors after this
            val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
            notificationManager.createNotificationChannel(mChannel)
        }

        // get reference to button
        val btn_click_me = findViewById<Button>(R.id.btn_click_me)

        // set on-click listener
        btn_click_me.setOnClickListener {
            Toast.makeText(this@MainActivity, "You clicked me.", Toast.LENGTH_SHORT).show()

            var builder = Notification.Builder(this, CHANNEL_ID)
                .setSmallIcon(R.drawable.logo)
                .setContentTitle("Test title")
                .setContentText("Test content")
                .setPriority(Notification.PRIORITY_DEFAULT)

            val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
            notificationManager.notify(1, builder.build())
        }
    }
}

Can you see anything stupid in my code? The CHANNEL_ID is the same both when creating the channel and creating the builder. The Notification has an ID > 0 (as I saw, 0 as the ID is not working); I also tried with other IDs as well.

I saw there are a "huge" improvement in the notifications with the latest SW upgrade (which can not been undone ........), but it is not working for me at all.

Is there anyone who had the same problem or sees the problem in my dummy code?

Kind regards,

1

There are 1 answers

0
Divesh On

I had to manually go to the SamsungWear app on my mobile , find the notifications screen in it's settings and enable notification for my app from over there.

Not sure if there is a convenient way to this ( Using intents or permission Pop-Up ). The documentation doesn't mention any such thing.