0

I have been doing lots of research trying to figure out if it is possible to create wear notifications with custom layouts over the past few months, but am struggling to find a solution.

I have tried to implement the following suggestions to no luck: https://possiblemobile.com/2014/07/create-custom-ongoing-notification-android-wear/

http://android-wear-docs.readthedocs.org/en/latest/sync.html

Custom UI for Android Wear Notifications

Most of what I have read have instructed that in order to do this, I should create an android wear app with a data listener. The idea being the phone would send certain data to the watch (say a string) based on the type of notification it wants to send. I would disable the automatically generated wear notification. In its place, the Android Wear app listener would know what type of notification it is based on the string and display my custom pages for that notification instead.

My first problem I have run into is I have no idea how to debug code like this. Since in Android studio you can only launch the device app or the wear app, but not both at the same time.

The other question I have is, does the Android Wear app run in the background when the Device App is running? Do you have to open the Android Wear App first for the listener to be even working (if so then I guess this is not a solution to custom notifications)?

Is it actually possible to create custom layout android wear notifications?

Community
  • 1
  • 1
user3712663
  • 21
  • 1
  • 4

1 Answers1

0

If you want to use a custom layout for your notifications, you should create the notification on the watch, following Creating Custom Layouts. You can even make the custom notifications clickable, you can add actions that will open activities on the watch, etc.

For that, you can send a message from your phone to your watch and the listener implemented on your watch will receive it and then, create and display the notification using the correct layout corresponding to the message sent, for example.

In this case, the best way is to implement a WearableListenerService on your wearable. Its lifecycle is handled by the system which binds it only when necessary.

To debug, you install the wear app on the wear emulator or your watch, you install the mobile app on your phone and finally you connect the two following this tutorial if you're using the emulator or via bluetooth if you're using a watch (link in the tutorial).

The Android Wear app connects your phone to your watch, whether it is an emulator or not. So, in order for your message to be received, you must have connected wear and mobile via Android Wear. Then, once the connection is established, you don't necessarily need to keep it open. So yes, the Android Wear app runs in background.

Kapouter
  • 147
  • 10