android-jobscheduler

Job Scheduler vs Background Service

心已入冬 提交于 2019-11-27 11:07:55
问题 I have an app which has a feature A which should run in background every minute. Feature A is that the app should connect to a database, read some data then get the current location of the device and based on them check a condition, if the condition is true it should send a statusbar notification to the user so that when the user clicks on the notification the UI of the app will be displayed and something happens. This background task should run permanently every minute, regardless the app is

Using a listener after an android application is closed

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 09:38:57
I've just been reading about adding a service to my application, and since 7/8 there are now service restrictions to improve phone performance. I've seen that the recommended approach is to use a job scheduler, but will that not just periodically start a new listener if I did that? Basically I update my database, and using a snapshot listener I want to update my user in real time. When the app is closed, I'd like to send a notification. My issues (if I'm correct) are that constantly making a new Firestore request will eat through my request allowance. Also, if its a job scheduler it won't

Android WorkManager api for running daily task in Background

匆匆过客 提交于 2019-11-27 03:17:14
问题 I need to call one API daily in the background even if the app is closed. I have seen about WorkManager API. For my scenario, I tried PeriodicWorkRequest but unfortunately, it's not working as my expected result. What I did is I used this code in the Application class PeriodicWorkRequest.Builder myWorkBuilder = new PeriodicWorkRequest.Builder(MyWorker.class, 24, TimeUnit.HOURS); PeriodicWorkRequest myWork = myWorkBuilder.build(); WorkManager.getInstance().enqueue(myWork); But it's running

Firebase JobDispatcher - how does it work compared to previous APIs (JobScheduler and GcmTaskService)?

两盒软妹~` 提交于 2019-11-26 23:33:02
Background Google has multiple solutions for job/task scheduling, such as JobScheduler and GcmTaskService . Each has its own advantages and disadvantages. Recently, Google presented a new library called "Firebase JobDispatcher". The problem Sadly, there is very little to read about this new API. In fact, it's really hard to find anything about it. Only thing I've found is their announcement video and a sample . But even their, there is not much to know about this API. The questions Looking at previous questions, investigations and comparisons I had with the other APIs ( here , for example), I

Android Oreo killing background services and clears pending alarms, scheduled jobs after entering doze mode

江枫思渺然 提交于 2019-11-26 21:32:38
问题 My app has a background service running that gets users current location and update it to a server every five minutes. To run this location update process continuously, I use alarm manager to set its next execution time from the service itself. However, when I install the app in my Nokia 6 running Android 8.1 it works for some time and if I keep the phone idle for some time, my service will get killed with the next alarms by the application also being cleared from system alarm manager . My

What tools are available to test JobScheduler?

百般思念 提交于 2019-11-26 18:55:26
问题 We're implementing a Job via JobScheduler for background loading of data. The job will fire about once a day. What tools are available for us to test this functionality (possibly ADB)? Use cases are to be able to simulate the conditions required for a Job to be run or to just say specifically "Run this job" as part of our automated test suite. 回答1: Right. Henning and P4u144 set me on the right track to answer this in more detail. Identify all registered jobs Identify your task with the adb

Job Scheduler not running on Android N

99封情书 提交于 2019-11-26 17:27:57
问题 Job Scheduler is working as expected on Android Marshmallow and Lollipop devices, but it is not running and Nexus 5x (Android N Preview). Code for scheduling the job ComponentName componentName = new ComponentName(MainActivity.this, TestJobService.class.getName()); JobInfo.Builder builder; builder = new JobInfo.Builder(JOB_ID, componentName); builder.setPeriodic(5000); JobInfo jobInfo; jobScheduler = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE); jobInfo = builder.build();

Using a listener after an android application is closed

爷,独闯天下 提交于 2019-11-26 14:48:13
问题 I've just been reading about adding a service to my application, and since 7/8 there are now service restrictions to improve phone performance. I've seen that the recommended approach is to use a job scheduler, but will that not just periodically start a new listener if I did that? Basically I update my database, and using a snapshot listener I want to update my user in real time. When the app is closed, I'd like to send a notification. My issues (if I'm correct) are that constantly making a

Firebase JobDispatcher - how does it work compared to previous APIs (JobScheduler and GcmTaskService)?

三世轮回 提交于 2019-11-26 08:46:24
问题 Background Google has multiple solutions for job/task scheduling, such as JobScheduler and GcmTaskService . Each has its own advantages and disadvantages. Recently, Google presented a new library called \"Firebase JobDispatcher\". The problem Sadly, there is very little to read about this new API. In fact, it\'s really hard to find anything about it. Only thing I\'ve found is their announcement video and a sample. But even their, there is not much to know about this API. The questions Looking