1

I need every 5 minute to check internet connection and send request to the server .If internet is not connected, I will make alert and change image view at tool bar .I used job scheduler .It does not work with 5 minutes . It works with minimum 15 minutes .

    JobInfo jobInfo = new JobInfo.Builder(123,componentName)
            .setRequiresCharging(true)
            .setRequiredNetworkType(JobInfo.NETWORK_TYPE_UNMETERED)
            .setPersisted(true)
            .setPeriodic(15*60*1000)
            .build();
AmlSakr
  • 11
  • 4
  • I believe 15 minutes is hardcoded in, see: https://stackoverflow.com/a/44169179/295004 Check: [Guide to Background Processing](https://developer.android.com/guide/background?hl=en) – Morrison Chang May 12 '19 at 02:09
  • I tried the first solution .It does not work with time less than 15 minutes .@MorrisonChang – AmlSakr May 12 '19 at 03:31
  • 1
    Your requirement of <15 minutes means that you need to use `AlarmManager`. – Morrison Chang May 12 '19 at 03:32
  • They said alarm manager do not use at android 8 "oreo" – AmlSakr May 13 '19 at 21:24
  • Don't know who "they" are. Also I just realized that your use case of notification when not on internet at such a high frequency doesn't make much sense, apps should handle the disconnected state. – Morrison Chang May 13 '19 at 23:35

0 Answers0