title: Android: How to refresh background after a fixed time interval?
body: <p>I am a newbie in android development. I am developing an application in which I need to update the data at every 15 mins. And If an activity is running and at the same time, data is updated by backend then the activity should also be updated, and if the application is closed a notification should be displayed.</p>
  
  <p>I am using retrofit for consuming the backend Apis. Is there any timer function is available for hitting API periodically using retrofit?</p>
  
  <p>As I googled my problem I found that it can be done by AlarmManager with BroadcastReceiver or firebase jobDispatcher, I'll be glad to know if there are more ways.</p>
  
  <p>What is the best and easiest approach?</p>