title: Android: Design consideration for periodic syncing with Sync Adapter
body: <p>I am using sync adapter in my app. The app should perform a sync at every 3 hours. This can be done with <code>ContentResolver.addPeriodicSync</code>. But, prior to that, with every sync request I need to send the access token of the user. The token's expiry time is of 2 hours. So, before any sync request it needs to have a valid access token. If the access token have expired, a fresh token needs to be updated for the user. </p>
  
  <p>One solution, I came up is to set a repeating alarm with using <code>AlarmManager</code>. When the alarm triggers, an <code>IntentService</code> will startup. and refreshes the access token for user. After new token is obtained, the sync request will be sent to the <code>SyncAdapter</code>, using <code>ContentResolver.requestSync</code>. I am not sure if this is a good way to do or any other efficient approach is available. </p>