New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 778599 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

Notifications don't show 'time' when timestamp is provided

Reported by chem...@gmail.com, Oct 26 2017

Issue description

Steps to reproduce the problem:
1. Go to this notification demo page: https://tests.peter.sh/notification-generator/
2. Set the timestamp to a value (for example, "5 minutes ago")
3. Click the "show the notif" button

What is the expected behavior?
I expect the notification on Android to show the time corresponding to the timestamp

What went wrong?
It doesn't show.

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 62.0  Channel: stable
OS Version: 8.0
Flash Version: 

Not sure if this only happens on Android 8.0 but I am pretty sure it used to work with earlier versions of Chrome on Android 6.0.
 
Cc: msrchandra@chromium.org
Labels: Needs-triage-Mobile Triaged-Mobile Needs-Feedback
@chemo.b -- Tested the issue on Android 8.1.0 / 7.0.0 / 5.0.0 / 4.4.4 and could not seen any Time stamp on the notification using Chrome Stable# 61.0.3163.98 / 62.0.3202.73 and Chrome Canary# 64.0.3250.0.
Could you please provide us a screen cast where exactly is the time stamp should be displayed which would help us in triaging the issue further.
Thanks in Advance.

Comment 2 by chem...@gmail.com, Oct 27 2017

See attached screenshot. Google Inbox shows the time in the first line (at the end). The notification above it doesn't (that's the one I created via a service worker).

I'm pretty sure this used to work on Android 6.0 and an older version of Chrome on my Moto X 2013.

According to this Platform Status document it should work as it says it's enabled by default starting with Chrome v50:
https://www.chromestatus.com/feature/5899831990026240
Screenshot_20171027-092153.png
84.2 KB View Download
Project Member

Comment 3 by sheriffbot@chromium.org, Oct 27 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "msrchandra@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Components: UI>Notifications
As per Comment# 2, assuming that the issue is not related to Chrome and is related to Android Notifications. 
Adding related component, could some one please look into the issue and provide an update.
Thanks in Advance.
Labels: Needs-Feedback

Comment 6 by chem...@gmail.com, Oct 30 2017

It looks like this changed in Android 7.0 and up:

"Add a timestamp pertaining to the notification (usually the time the event occurred). For apps targeting N and above, this time is not shown anymore by default and must be opted into by using setShowWhen(boolean)"

https://developer.android.com/reference/android/app/Notification.Builder.html#setWhen(long)

Is it possible that Chrome uses setWhen and not setShowWhen?
Project Member

Comment 7 by sheriffbot@chromium.org, Oct 30 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "msrchandra@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 8 by awdf@chromium.org, Oct 30 2017

Owner: awdf@chromium.org
Status: Assigned (was: Unconfirmed)

Comment 9 by awdf@chromium.org, Nov 1 2017

Status: Started (was: Assigned)

Comment 10 by awdf@chromium.org, Nov 2 2017

Cc: awdf@chromium.org owe...@chromium.org
Owner: owe...@chromium.org
Status: Assigned (was: Started)
Thanks for the bug report chemo.b@

Your comment in #6 is correct - indeed Chrome calls setWhen with either the current timestamp or a custom timestamp if one is provided, and does not currently call setShowWhen(true), so the difference you observe is due to the different default showWhen behaviour on different versions of Android.

@Owen what do you think we should do here? It would be tricky to only show the timestamp if the web developer provides one, so I propose we either:

1. Start always showing the timestamp on all versions of Android

2. Do nothing and leave this as WAI.
I think we should just always show it.

Deciding to only show the timestamp if the developer provided one is tricky because the spec defines that it defaults to the time of posting, so we'd need a whole lot of logic to be able to distinguish those cases.

Deciding not to show the timestamp at all means we've dropped the feature, and should go through the Blink deprecation process.

Personally I think that knowing *when* a notification was, or will be relevant is a good feature. Most apps on my device (including various Google ones) show the timestamp too.
+1, always showing it sounds reasonable to me, and like the easiest option.

I suggest we do that and then only revisit if somebody complains that they do not want a timestamp to be shown, at which point it seems we'd have the option of attempting to update the spec or something else complicated.

Comment 13 by awdf@chromium.org, Nov 2 2017

Owner: awdf@chromium.org
Status: Started (was: Assigned)
Sgtm. I'll submit a patch today so this change will be in our next release (Chrome version 64).

Thanks all.

Comment 15 by chem...@gmail.com, Nov 2 2017

Great, thanks guys/gals/others :)

Just a suggestion regarding the "not showing the timestamp"; maybe if the developer sets the timestamp to '0' or '-1' it could be ignored?


Project Member

Comment 16 by bugdroid1@chromium.org, Nov 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2afba10191425c4ec8ea2b8e54c4853423e4cee8

commit 2afba10191425c4ec8ea2b8e54c4853423e4cee8
Author: Anita Woodruff <awdf@chromium.org>
Date: Fri Nov 03 17:13:31 2017

[Android web notifications] Always show timestamp

- Previously, we always set a timestamp on web notifications,
but we defaulted to Android to decide whether or not to show it.

- Now we ensure the timestamp is always shown, regardless of
Android version.

Bug:  778599 
Change-Id: I17a6a8ee1ef8d847b64364125dfb2234c84d65d4
Reviewed-on: https://chromium-review.googlesource.com/749403
Commit-Queue: Anita Woodruff <awdf@chromium.org>
Reviewed-by: Peter Beverloo <peter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#513812}
[modify] https://crrev.com/2afba10191425c4ec8ea2b8e54c4853423e4cee8/chrome/android/java/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilder.java
[modify] https://crrev.com/2afba10191425c4ec8ea2b8e54c4853423e4cee8/chrome/android/java/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilder.java
[modify] https://crrev.com/2afba10191425c4ec8ea2b8e54c4853423e4cee8/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeTest.java
[modify] https://crrev.com/2afba10191425c4ec8ea2b8e54c4853423e4cee8/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationTestUtil.java

Comment 17 by awdf@chromium.org, Dec 20 2017

Status: Fixed (was: Started)
Cc: na...@chromium.org wic...@olseryd.se
 Issue 755143  has been merged into this issue.

Sign in to add a comment