Giter Club home page Giter Club logo

Comments (4)

georggrab avatar georggrab commented on September 6, 2024

Hi there, your App looks fine, and I just tested it on my Test Device; the Job gets run there. Can you share more information about your Environment? Do you happen to run on API Level < 21, where the Job Scheduler isn't available? Could you test it on a recent Android Emulator?
Thanks for the hint regarding the examples, you're exactly right, they are outdated.

from android_job_scheduler.

piotrpalek avatar piotrpalek commented on September 6, 2024

Hmm this is weird, it ran for a bit, but now doesn't. My device is Samsung Galaxy S5 with Android 6.0.1 so the API version should be good.

It sometimes runs, but very rare and not consistently (I think sometimes when I close the app). I've also noticed this in the logs when it's running:

06-22 11:05:59.990 31058 31307 V AlarmManager: Expired Alarm result :8
06-22 11:06:26.620 31058 31307 V AlarmManager: Expired Alarm result :8
06-22 11:06:31.440 31058 32447 V AlarmManager:  remove PendingIntent] PendingIntent{a03ba5: PendingIntentRecord{40212a6 com.google.android.gms broadcastIntent}}

edit: just to confirm, tried it on a Pixel 2 and it runs smoothly there
edit2: tried to run on an emulator with API level 23 (x86) and it doesn't run there as well for me

from android_job_scheduler.

georggrab avatar georggrab commented on September 6, 2024

Thanks for bringing this to my attention. This is likely a problem with the Service implementation. One thing to note here is that the Android OS normally doesn't allow you to schedule jobs at a more frequent interval than 15min. One possibility (read "hack") to work around this is to Schedule OneShot Jobs, and reschedule another OneShot Job at the end, which is how the service is implemented. I'll investigate how this is behaving on lower API levels, it probably is breaking at that stage.

Did you, by any chance, notice any exceptions thrown by the Jobscheduler (io.gjg.androidjobscheduler) service? Also, are you able to reproduce the problem with the example app provided in this repo? This would help us rule out any issues related to Logging, because the Job in the example app is performing a much more visible thing than just printing text (writing state to persistent storage)

from android_job_scheduler.

piotrpalek avatar piotrpalek commented on September 6, 2024

No, I didn't see any exceptions thrown by the Jobscheduler, also I've just tried the example app in the repo. It seems to work! But I have no idea what I'm doing wrong in my example :)

btw. do the jobs run when the phone is locked / in sleep mode? The logs seem to pause when the phone is locked.

edit:

I've had a bunch of weird behaviors, I'm not sure how to reproduce them but I'll list them anyway for now (sorry if this is vague):

  • it seems that when I've installed the example app from the repo, and started a timer it worked and it also seemed to trigger the timer from my test app. To make it clear, the bg job from my test app didn't work, but when I've started the job in the example app the job from my test app started to trigger, but produced an error:
/flutter ( 8735): [ERROR:flutter/shell/platform/android/android_context_gl.cc(217)] Could not make the context current
E/flutter ( 8735): [ERROR:flutter/shell/platform/android/android_context_gl.cc(53)] EGL Error: EGL_BAD_ACCESS (12290)
  • after that I have played around with the example app and it seems I've broken the job scheduling somehow (didn't work no matter what I did, force close, uninstall / reinstall, clear app data). After that I've tried to reboot the phone, and now after I've scheduled a job, and move the app to the background (press home btn) I've got this:
(...)
I/flutter ( 5994): Contents: 13
I/flutter ( 5994): Yolo executing
I/flutter ( 5994): Contents: 14
V/ActivityThread( 5994): updateVisibility : ActivityRecord{80bad5a token=android.os.BinderProxy@3fe5ca9 {io.gjg.androidjobschedulerexample/io.gjg.androidjobschedulerexample.MainActivity}} show : false
W/art     ( 5994): Native thread exiting without having called DetachCurrentThread (maybe it's going to use a pthread_key_create destructor?): Thread[13,tid=8674,Native,Thread*=0x98bb6900,peer=0x32d4b0a0,"Thread-755"]
D/ViewRootImpl( 5994): #3 mView = null
D/FlutterNativeView( 5994): FlutterView.send called on a detached view, channel=plugins.gjg.io/android_job_scheduler
D/FlutterNativeView( 5994): FlutterView.send called on a detached view, channel=plugins.gjg.io/android_job_scheduler
(...)

from android_job_scheduler.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.