jobintentservice

Using Firestore from a JobIntentService: Failed to gain exclusive lock to the Firestore client's offline persistence

帅比萌擦擦* 提交于 2019-12-13 04:00:02
问题 Whenever I exit the app while I have an alarm set and the alarm goes off while the app is "DEAD" I get an Exception while trying to update a field in Firestore. The code works when the app is running in the foreground so I really have no clue of what is going on. Either way, here is the code for 2 functions which get called from the JobIntentService which is in turn created from a BroadcastReceiver: private val firestoreInstance: FirebaseFirestore by lazy { FirebaseFirestore.getInstance() }

Android: How to fix BroadcastReceiver in JobIntentService?

丶灬走出姿态 提交于 2019-12-07 02:40:36
I have an Activity with an AlarmManager that fires a BroadcastReceiver. The BroadcastReceiver fires a JobIntentService to send a Notification to the user. When the user taps "CLEAR ALL" or swipes to dismiss the Notification, I want the setDeleteIntent() to reset a counter variable "totalMessages" to zero that I set up in a SharedPreferences file. It is not resetting to zero. What am I missing here? public class AlarmService extends JobIntentService { static final int JOB_ID = 9999; public static final String NOTIFICATIONS_COUNTER = "NotificationsCounter"; private static final int REQUEST_CODE

Start a JobIntentService Implicitly

爷,独闯天下 提交于 2019-12-06 17:07:39
问题 As you know this is how we fire a JobIntentService : JobIntentService.enqueueWork(this, MyJobIntentService.class, JOB_ID, intent); In this approach we KNOW which service we want to start and pass its class to the method. Here is my question : Is there any way to start a service implicitly ? Why I need this ? I'm developing a library that sometimes should start a service that developer extends and obviously I have no access to it from library What I tried? I implemented it with IntentService

Android Oreo JobIntentService Keep running in background for Android 7 &below and crashing often in Android 8 & above

前提是你 提交于 2019-12-03 03:29:14
I have recently replaced all my service to foreground services and JobIntentService since there are some background execution limits ( https://developer.android.com/about/versions/oreo/background ) in oreo and above. As per documentation, JobIntentService acts like Intent Service for Android 7 & below and acts like JobScheduler for Android 8 & above. I have noticed there is an issue in new JobIntentService provided by Google. Android 8 & above: There is a crash happening continuously in android 8 and above. There was a ticket raised here mentioning about the same issue https://issuetracker

Custom JobIntentService onHandleWork not called

谁说胖子不能爱 提交于 2019-11-27 21:08:04
问题 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=