title: Android background task for calling API every 5 seconds
body: <p>I want to control my Android App via my API. 
  For that I need to have a background task that calls the API every 5 seconds (but it must know when the API has finished, then wait 5 seconds and call again).</p>
  
  <p>Then if there is a new data on the API, Control the App aspect such as(play video, stop video. play video playlist)</p>
  
  <p>My question is, What is the best solution to implement these requirements. </p>
  
  <p>I really appreciate any help guys thanks again. 
  P.S. I am novice to android.</p>
  
  <p><strong>More info on - Controlling the app's aspects</strong>.</p>
  
  <p>I have to conduct a Video player test on 300 tablets. all at the same time.</p>
  
  <p>So the App will listen/wait for a command from the API. 
  the API command by defaut will be false.</p>
  
  <p>When there is a new command (i.e. play video 1). the app will execute it.</p>
  
  <p>Some commends the API will pass can be:
  Play Video, Stop Video. Play all Video. Exit the App.</p>
  
  <p>Therefore the API Listener method has to be always running in the back end, if there is a new command than execute it.</p>
  
  <p>Thank guys.</p>