Firebase Job Dispatcher not Scheduling jobs on OREO devices
up vote
0
down vote
favorite
I have a firebase job dispatcher which is scheduled to run whenever network changes ,the job is working perfectly on a marshmallow device (23 API level) but the same code when run is not scheduling jobs on a oreo device(26 API level)
Here is my Job Service code:
public class MyJobService extends JobService
@Override
public boolean onStartJob(JobParameters job)
Log.d("Executing","Job");
Realm realm = Realm.getDefaultInstance();
RealmResults<JsontoSend> realmResults = realm.where(JsontoSend.class).findAll();
if(!realmResults.isEmpty())
for (JsontoSend jsontoSend : realmResults)
final Intent intent = new Intent(getApplicationContext(), PostUploadIntentService.class);
intent.putExtra("object", jsontoSend.getJson());
new Thread(new Runnable()
@Override
public void run()
startService(intent);
).run();
return true;
@Override
public boolean onStopJob(JobParameters job)
Log.d("instopjob","cancelled");
return true;
This is my code where i have created the job :
synchronized public static void schedule(@NonNull final Context context)
if(sInitialized)
return;
Driver driver=new GooglePlayDriver(context);
FirebaseJobDispatcher dispatcher=new FirebaseJobDispatcher(driver);
Job myJob = dispatcher.newJobBuilder()
.setService(MyJobService.class)
.setTag(JOB_TAG)
.setRecurring(true)
.setTrigger(Trigger.executionWindow(5, 60))
.setLifetime(Lifetime.FOREVER)
.setConstraints(Constraint.ON_ANY_NETWORK)
.setReplaceCurrent(false)
.setRetryStrategy(RetryStrategy.DEFAULT_EXPONENTIAL)
.build();
dispatcher.schedule(myJob);
sInitialized=true;
What i am trying to do is if i do not have internet connection then storing the data in local database and then running a job whenever i connect to internet and sync the data with server .The above code is working perfectly on marshmallow device but the job is never scheduled on oreo devices.
android job-scheduling firebase-job-dispatcher
add a comment |
up vote
0
down vote
favorite
I have a firebase job dispatcher which is scheduled to run whenever network changes ,the job is working perfectly on a marshmallow device (23 API level) but the same code when run is not scheduling jobs on a oreo device(26 API level)
Here is my Job Service code:
public class MyJobService extends JobService
@Override
public boolean onStartJob(JobParameters job)
Log.d("Executing","Job");
Realm realm = Realm.getDefaultInstance();
RealmResults<JsontoSend> realmResults = realm.where(JsontoSend.class).findAll();
if(!realmResults.isEmpty())
for (JsontoSend jsontoSend : realmResults)
final Intent intent = new Intent(getApplicationContext(), PostUploadIntentService.class);
intent.putExtra("object", jsontoSend.getJson());
new Thread(new Runnable()
@Override
public void run()
startService(intent);
).run();
return true;
@Override
public boolean onStopJob(JobParameters job)
Log.d("instopjob","cancelled");
return true;
This is my code where i have created the job :
synchronized public static void schedule(@NonNull final Context context)
if(sInitialized)
return;
Driver driver=new GooglePlayDriver(context);
FirebaseJobDispatcher dispatcher=new FirebaseJobDispatcher(driver);
Job myJob = dispatcher.newJobBuilder()
.setService(MyJobService.class)
.setTag(JOB_TAG)
.setRecurring(true)
.setTrigger(Trigger.executionWindow(5, 60))
.setLifetime(Lifetime.FOREVER)
.setConstraints(Constraint.ON_ANY_NETWORK)
.setReplaceCurrent(false)
.setRetryStrategy(RetryStrategy.DEFAULT_EXPONENTIAL)
.build();
dispatcher.schedule(myJob);
sInitialized=true;
What i am trying to do is if i do not have internet connection then storing the data in local database and then running a job whenever i connect to internet and sync the data with server .The above code is working perfectly on marshmallow device but the job is never scheduled on oreo devices.
android job-scheduling firebase-job-dispatcher
Sorry man, I have no idea why it doesn't work. But why do you use the firebase scheduler? Do you target on devices before 5.0 ?
– Flavio
Nov 12 at 18:04
@Flavio can you give me some other approach that works on oreo devices for the same(i mean sync data to server whenever internet is connected).
– shashank chandak
Nov 12 at 18:06
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a firebase job dispatcher which is scheduled to run whenever network changes ,the job is working perfectly on a marshmallow device (23 API level) but the same code when run is not scheduling jobs on a oreo device(26 API level)
Here is my Job Service code:
public class MyJobService extends JobService
@Override
public boolean onStartJob(JobParameters job)
Log.d("Executing","Job");
Realm realm = Realm.getDefaultInstance();
RealmResults<JsontoSend> realmResults = realm.where(JsontoSend.class).findAll();
if(!realmResults.isEmpty())
for (JsontoSend jsontoSend : realmResults)
final Intent intent = new Intent(getApplicationContext(), PostUploadIntentService.class);
intent.putExtra("object", jsontoSend.getJson());
new Thread(new Runnable()
@Override
public void run()
startService(intent);
).run();
return true;
@Override
public boolean onStopJob(JobParameters job)
Log.d("instopjob","cancelled");
return true;
This is my code where i have created the job :
synchronized public static void schedule(@NonNull final Context context)
if(sInitialized)
return;
Driver driver=new GooglePlayDriver(context);
FirebaseJobDispatcher dispatcher=new FirebaseJobDispatcher(driver);
Job myJob = dispatcher.newJobBuilder()
.setService(MyJobService.class)
.setTag(JOB_TAG)
.setRecurring(true)
.setTrigger(Trigger.executionWindow(5, 60))
.setLifetime(Lifetime.FOREVER)
.setConstraints(Constraint.ON_ANY_NETWORK)
.setReplaceCurrent(false)
.setRetryStrategy(RetryStrategy.DEFAULT_EXPONENTIAL)
.build();
dispatcher.schedule(myJob);
sInitialized=true;
What i am trying to do is if i do not have internet connection then storing the data in local database and then running a job whenever i connect to internet and sync the data with server .The above code is working perfectly on marshmallow device but the job is never scheduled on oreo devices.
android job-scheduling firebase-job-dispatcher
I have a firebase job dispatcher which is scheduled to run whenever network changes ,the job is working perfectly on a marshmallow device (23 API level) but the same code when run is not scheduling jobs on a oreo device(26 API level)
Here is my Job Service code:
public class MyJobService extends JobService
@Override
public boolean onStartJob(JobParameters job)
Log.d("Executing","Job");
Realm realm = Realm.getDefaultInstance();
RealmResults<JsontoSend> realmResults = realm.where(JsontoSend.class).findAll();
if(!realmResults.isEmpty())
for (JsontoSend jsontoSend : realmResults)
final Intent intent = new Intent(getApplicationContext(), PostUploadIntentService.class);
intent.putExtra("object", jsontoSend.getJson());
new Thread(new Runnable()
@Override
public void run()
startService(intent);
).run();
return true;
@Override
public boolean onStopJob(JobParameters job)
Log.d("instopjob","cancelled");
return true;
This is my code where i have created the job :
synchronized public static void schedule(@NonNull final Context context)
if(sInitialized)
return;
Driver driver=new GooglePlayDriver(context);
FirebaseJobDispatcher dispatcher=new FirebaseJobDispatcher(driver);
Job myJob = dispatcher.newJobBuilder()
.setService(MyJobService.class)
.setTag(JOB_TAG)
.setRecurring(true)
.setTrigger(Trigger.executionWindow(5, 60))
.setLifetime(Lifetime.FOREVER)
.setConstraints(Constraint.ON_ANY_NETWORK)
.setReplaceCurrent(false)
.setRetryStrategy(RetryStrategy.DEFAULT_EXPONENTIAL)
.build();
dispatcher.schedule(myJob);
sInitialized=true;
What i am trying to do is if i do not have internet connection then storing the data in local database and then running a job whenever i connect to internet and sync the data with server .The above code is working perfectly on marshmallow device but the job is never scheduled on oreo devices.
android job-scheduling firebase-job-dispatcher
android job-scheduling firebase-job-dispatcher
edited Nov 11 at 7:30
asked Nov 10 at 16:45
shashank chandak
175111
175111
Sorry man, I have no idea why it doesn't work. But why do you use the firebase scheduler? Do you target on devices before 5.0 ?
– Flavio
Nov 12 at 18:04
@Flavio can you give me some other approach that works on oreo devices for the same(i mean sync data to server whenever internet is connected).
– shashank chandak
Nov 12 at 18:06
add a comment |
Sorry man, I have no idea why it doesn't work. But why do you use the firebase scheduler? Do you target on devices before 5.0 ?
– Flavio
Nov 12 at 18:04
@Flavio can you give me some other approach that works on oreo devices for the same(i mean sync data to server whenever internet is connected).
– shashank chandak
Nov 12 at 18:06
Sorry man, I have no idea why it doesn't work. But why do you use the firebase scheduler? Do you target on devices before 5.0 ?
– Flavio
Nov 12 at 18:04
Sorry man, I have no idea why it doesn't work. But why do you use the firebase scheduler? Do you target on devices before 5.0 ?
– Flavio
Nov 12 at 18:04
@Flavio can you give me some other approach that works on oreo devices for the same(i mean sync data to server whenever internet is connected).
– shashank chandak
Nov 12 at 18:06
@Flavio can you give me some other approach that works on oreo devices for the same(i mean sync data to server whenever internet is connected).
– shashank chandak
Nov 12 at 18:06
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
well the problem here is probably because you use GooglePlayDriver which relies on google play services to be presented on the devices. If the services are not available the job will not be scheduled.
So if you target on devices higher than 5.0 (which is true in most cases) you have to use android's JobScheduler build in since lollipop.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
well the problem here is probably because you use GooglePlayDriver which relies on google play services to be presented on the devices. If the services are not available the job will not be scheduled.
So if you target on devices higher than 5.0 (which is true in most cases) you have to use android's JobScheduler build in since lollipop.
add a comment |
up vote
0
down vote
well the problem here is probably because you use GooglePlayDriver which relies on google play services to be presented on the devices. If the services are not available the job will not be scheduled.
So if you target on devices higher than 5.0 (which is true in most cases) you have to use android's JobScheduler build in since lollipop.
add a comment |
up vote
0
down vote
up vote
0
down vote
well the problem here is probably because you use GooglePlayDriver which relies on google play services to be presented on the devices. If the services are not available the job will not be scheduled.
So if you target on devices higher than 5.0 (which is true in most cases) you have to use android's JobScheduler build in since lollipop.
well the problem here is probably because you use GooglePlayDriver which relies on google play services to be presented on the devices. If the services are not available the job will not be scheduled.
So if you target on devices higher than 5.0 (which is true in most cases) you have to use android's JobScheduler build in since lollipop.
answered Nov 12 at 18:22
Flavio
5,20832528
5,20832528
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53241140%2ffirebase-job-dispatcher-not-scheduling-jobs-on-oreo-devices%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Sorry man, I have no idea why it doesn't work. But why do you use the firebase scheduler? Do you target on devices before 5.0 ?
– Flavio
Nov 12 at 18:04
@Flavio can you give me some other approach that works on oreo devices for the same(i mean sync data to server whenever internet is connected).
– shashank chandak
Nov 12 at 18:06