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

Issue 663427 link

Starred by 1 user

Issue metadata

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

Blocking:
issue 685197



Sign in to add a comment

Use the Android JobScheduler to start our NotificationService

Project Member Reported by awdf@chromium.org, Nov 8 2016

Issue description

Right now we start the service directly from the BroadcastReceiver here:

https://cs.chromium.org/chromium/src/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java?dr&q=NotificationService&sq=package:chromium&l=40

but in future we should instead schedule a job to start the background service.

From https://developer.android.com/topic/performance/scheduling.html#js :

"If your app targets Android 5.0 (API level 21), you should use JobScheduler to execute background tasks."

And further down on that page:

"Use started services only as a last resort. The Android platform may not support started [background] services in the future."
 

Comment 1 by awdf@chromium.org, Jan 11 2017

Description: Show this description

Comment 2 by awdf@chromium.org, Jan 11 2017

Description: Show this description

Comment 3 by awdf@chromium.org, Jan 13 2017

Status: Started (was: Assigned)

Comment 4 by awdf@chromium.org, Jan 25 2017

Blocking: 685197
Project Member

Comment 5 by bugdroid1@chromium.org, Jan 25 2017

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

commit d54134355647e110b2d6793d2b257dceb4b706ed
Author: awdf <awdf@chromium.org>
Date: Wed Jan 25 19:03:58 2017

Android web notifications: Schedule job instead of starting service (N+)

- Previously we always started a service when a web notification was
clicked or dismissed.

- Now we instead schedule a job to handle the notification intent on
N+, since this is encouraged by Android.

- We use the Android JobScheduler, rather than GcmNetworkManager or
FirebaseJobDispatcher, since the JobScheduler allows us to execute
immediately (hopefully).

BUG= 663427 ,680816

Review-Url: https://codereview.chromium.org/2611333002
Cr-Commit-Position: refs/heads/master@{#446072}

[modify] https://crrev.com/d54134355647e110b2d6793d2b257dceb4b706ed/chrome/android/java/AndroidManifest.xml
[modify] https://crrev.com/d54134355647e110b2d6793d2b257dceb4b706ed/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationConstants.java
[add] https://crrev.com/d54134355647e110b2d6793d2b257dceb4b706ed/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationJobService.java
[modify] https://crrev.com/d54134355647e110b2d6793d2b257dceb4b706ed/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java
[modify] https://crrev.com/d54134355647e110b2d6793d2b257dceb4b706ed/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java
[modify] https://crrev.com/d54134355647e110b2d6793d2b257dceb4b706ed/chrome/android/java_sources.gni

Comment 6 by awdf@chromium.org, Jan 30 2017

Status: Fixed (was: Started)

Sign in to add a comment