w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Android Wear: Timer like notification card on wear device

To update ongoing/existing notification -

  1. Use Same Id of Notification in Builder
  2. Use .setOnlyAlertOnce(true)

NotificationCompat.Builder notificationBuilder; public void generateNotificationForTimer(String timeInString, boolean isFirstTime) { if (isFirstTime) { notificationBuilder = new NotificationCompat.Builder(this) .setStyle(new NotificationCompat.BigPictureStyle()) .setOnlyAlertOnce(true) .setContentTitle("Timer Notification Demo") .setContentText("Time - " + timeInString) .setSmallIcon(R.drawable.common_signin_btn_icon_dark); NotificationManagerCompat.from(this).notify(110, notificationBuilder.build()); } else { notificationBuilder.setContentText(timeInString); NotificationManagerCompat.from(this).notify(110, notificationBuilder.build()); } }





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.