I recently was updating an app that I work on to handle notifications from push using a JobIntentService
instead of a regular IntentService
because it seems like the correct way to handle this on pre-Lollipop devices as well as post. I am enqueueing work as such:
enqueueWork(context, MyJobServiceExtension.class, JOB_ID, work);
This is the manifest declaration:
<service android:name="com.example.MyJobServiceExtension"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="true"
tools:node="replace">
I never see any callbacks in onHandleWork
or any error logs in my logcat. Has anyone successfully integrated this that could help?
Update 1
I tested this on an API level 21 device and it worked.. but it doesn't seem to be getting called on my Android Oreo Pixel XL device.. Any clues as to why?
Update 2
Also I seem to be seeing the IntentService's onCreate
be called, but none of the other lifecycle methods (including onHandleWork
). Has anyone encountered this either?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…