title: Background service are not working in Android in sleep mode
body: <p>In my Android application, I am tracking user location at 5 pm daily and sending that location to the server. For that, I am running one service.
  But my issue is that services are starting if the application is in foreground mode. But if the application is in background mode for more than 10 minutes or the next date.
  Then service is not starting. Below is my code for service start.</p>
  <pre><code>Log.d(&quot;Service log&quot;,&quot;service will start&quot;);
  if( (ContextCompat.checkSelfPermission(context, 
             Manifest.permission.ACCESS_FINE_LOCATION)) == 
                      PackageManager.PERMISSION_GRANTED){
  Intent backgnd = new Intent(context, BackgrndService.class);
  if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.O) {
  try{ 
    Log.d(&quot;Service log&quot;,&quot;service starting in oreo&quot;);
                               context.stopService(backgnd);
                             context.startForegroundService(backgnd);}
                             catch(Exception e){
                                context.startForegroundService(backgnd);
                             }
                          }else {
                              
                             try{ 
                             Log.d(&quot;Service log&quot;,&quot;service start&quot;);
                               context.stopService(backgnd);
                             context.startService(backgnd);}
                             catch(Exception e){
                                context.startService(backgnd);
                             }
                          }
                      }else{
                          Log.d(&quot;Service log&quot;,&quot;NO Access Location permission&quot;);
                      }
                      
  </code></pre>
  <p>In LogCat i am able to see first log.But other log not showing.
  Please provide the suggestion how to run that service in background mode(sleep mode).</p>