Android Wear : Custom Notifications -


in handheld devices, custom notifications can displayed using remoteviews. remoteviews allows developer customise notification.

what way same android wear? class should used override default notification ui own customised one?

  1. if want customize text only, can use spannablestring. allows change color, background, align of title/content text.

  2. if want create totally different notification have implement smth similar in wear project

    intent notificationintent = new intent(context, wearnotificationactivity.class); pendingintent pendingnotificationintent =         pendingintent.getactivity(context, 0, notificationintent,pendingintent.flag_update_current);      notification notification =             new notification.builder(context)                     .setsmallicon(r.drawable.ic_launcher)                     // .setcontenttitle("customnotification")                     .extend(new notification.wearableextender()                             .setdisplayintent(pendingnotificationintent)                             .setcustomsizepreset(notification.wearableextender.size_large)                             .setstartscrollbottom(false)                             .sethinthideicon(true))                      .build();      notificationmanager notificationmanager =             (notificationmanager) context.getsystemservice(context.notification_service);      notificationmanager.notify(0, notification); 

where wearnotificationactivity - activity container of custom view.

note: have use .setsmallicon(..) if don't need it. seems google bug, without line notification won't shown.

and set

 android:allowembedded="true"  android:taskaffinity="" 

for activity container


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -