-
-
Notifications
You must be signed in to change notification settings - Fork 735
Use JobScheduler for push #735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #735 +/- ##
===========================================
- Coverage 53.58% 53.39% -0.2%
+ Complexity 1747 1746 -1
===========================================
Files 131 132 +1
Lines 10258 10284 +26
Branches 1435 1426 -9
===========================================
- Hits 5497 5491 -6
- Misses 4304 4338 +34
+ Partials 457 455 -2
Continue to review full report at Codecov.
|
Parse/src/main/AndroidManifest.xml
Outdated
<application /> | ||
<application> | ||
<service | ||
android:name=".PushService26" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PushServiceApi26?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah better.
synchronized (PushService.class) { | ||
serviceLifecycleCallbacks.remove(callbacks); | ||
if (serviceLifecycleCallbacks.size() <= 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason for getting rid of this block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I just think it made no sense to null this. These ServiceLifecycleCallbacks are made just for internal use in tests (PushServiceTest) so we can design them as we wish, I think the old logic was way too verbose
|
||
// Our manifest file is OK. | ||
static boolean isSupported() { | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should you check whether the job service is declared?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original PushService has a check here because it must be declared by the developer in each app. With PushServiceApi26 I have declared it in our own manifest, which should be merged with the application manifest when building the app. So I guess that's a true.
Wraps PushService initialization in the
PushServiceUtils
class. On Android Oreo, it uses the Job scheduler APIs to launchPushService26
. This is already declared in our manifest so no changes for developers.FIxes #729
PushService26
being a declared service must be public. Correct me if I am wrongPushServiceOreo
if you think it's better