0

I'm playing with Android Wear notifications a little and use the DataApi to trigger them from the wear device. Nevertheless, I don't manage to figure out how we could have notifications like the demo cards in the android Wear mobile application.

For example : public transport or flight info or even the weather forecast cards.

I tried a setDisplayIntent but it is only showing when the user swipe the notif up.

As it is written in the doc

Note: When the notification is peeking on the homescreen, the system displays it with a standard template that it generates from the notification's semantic data. This template works well on all watchfaces. When users swipe the notification up, they'll then see the custom activity for the notification.

What I am looking for is a way to change this default template, as Google do in the demo cards.

Do you have any idea on how to do that?

Have all a very good day and thanks for your help.

jn.

Maciej Ciemięga
  • 10,125
  • 1
  • 41
  • 48
bisonfute
  • 91
  • 1
  • 9
  • I'm afraid that this is not possible in current version of API. – Maciej Ciemięga Aug 22 '14 at 14:05
  • aargh. But if Google is able to do it, does that mean that it is available but APIs are not documented? Moreover, what do you think of the idea to use a "Notification.Builder" setContent(RemoteViews views) >>>Supply a custom RemoteViews to use instead of the platformtemplate. and trigger it from the wear device? – bisonfute Aug 22 '14 at 14:44
  • The collapsed form of the weather forecast, package shipping, and others look like the default template - can you show an example of a custom template peeking on the homescreen? – ianhanniballake Aug 24 '14 at 16:49
  • It is currently possible - http://stackoverflow.com/questions/28603086/custom-ui-for-android-wear-notifications – Michał Tajchert Apr 18 '15 at 16:46

1 Answers1

2

As stated by Wayne Piekarski, it is not possible for now to get the exact same look of the collapsed sample cards: https://plus.google.com/u/0/100517480770286602327/posts/2o4SVBhWg5z

However, you can use Spannable to change the font weight or the text color.

String title = "My notification title!";
    Spannable customTitle = new SpannableString(title);
    customTitle.setSpan(new ForegroundColorSpan(0xff83ae7b), 0, title.length(), 0);

    Notification notificationBuilder = new Notification.Builder(this)
                    ...
                    .setContentTitle(customTitle)               
                    ...
            .build();
Nicolas POMEPUY
  • 1,123
  • 9
  • 11
  • I missed that discussion on Google+. **Thank you Nicolas** for showing it to me. It is clearly the beginning of the answer, I hope Google will release more APIs soon! – bisonfute Aug 25 '14 at 12:20