2

i have a service that fetches location data and a job service that gets triggered every 10 seconds that sends the location data to a server. everything works perfectly but i am noticing that the app stops receiving internet connection after about 10 mins though whatsapp for example still receives connection. also, as soon as i turn on the screen, the job service is sending the data. i checked if the battery saver is on but its not and whatsapp as i said is working perfectly

any help?

Note: i performed some external logging to ensure that the job is being triggered correctly and it was... the logging was made to check the internet connection once the job service is triggered and at first it was returning that there is a connection, then after about 10 mins, the logs stated that the app lost connection

the device i am testing with is a Samsung S5 and the OS is Nougat

FirebaseJobDispatcher dispatcher = getFireBaseJobDispatcher(context);
        Job constraintGTMServiceJob = dispatcher.newJobBuilder()
                .setService(GTMJobService.class)
                .setTag(GTM_JOB_TAG)
                .setLifetime(Lifetime.FOREVER)
                .setRecurring(true)
                .setConstraints(Constraint.ON_ANY_NETWORK)
                .setTrigger(Trigger.executionWindow(GTM_SERVICE_INTERVAL_SECONDS,GTM_SERVICE_INTERVAL_SECONDS))
                .setReplaceCurrent(true)
                .build();
        dispatcher.schedule(constraintGTMServiceJob);

i am sending the data in the job service using retrofit

i can post more code if needed

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Rashad.Z
  • 2,494
  • 2
  • 27
  • 58

0 Answers0