我有一个通知构建器。我想添加类似于WhatsApp通话通知的通知计时器。所以如果我调用updateNotifTime函数,它不起作用。
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, callChannelId)
.setSmallIcon(R.drawable.call_icon)
.setContentIntent(pendingIntent)
.setOngoing(true)
.setShowWhen(true)
.setWhen(System.currentTimeMillis())
.setPriority(NotificationCompat.PRIORITY_HIGH);
public void updateNotifTime() {
this.callingElapsedRunnable = new Runnable() {
@Override
public void run() {
elapsedTime += 1000;
String timer = DateUtils.calculateTime(elapsedTime);
builder.setWhen(elapsedTime);
callingElapsedHandler.postDelayed(this, 1000);
}
};
callingElapsedHandler.postDelayed(callingElapsedRunnable, 1000);
}
.setChronometerCountDown(true)
- ManmeetP