googleworkspace / android-samples

Android samples for Google Workspace APIs
Apache License 2.0
635 stars 410 forks source link

Please provide an example, on how to perform background sync task if I were using GoogleSignIn + DriveClient #77

Open yccheok opened 6 years ago

yccheok commented 6 years ago

Our users have a chance to login, to authorize the app access to their Google Drive. We implement based on GoogleSignIn and DriveClient. (Not the yet another deprecated API GoogleApiClient)

https://developers.google.com/drive/android/auth

After the users quit the app, we would like to Google Drive sync process still work seamlessly in background, without further user/UI interaction. (Able to handle case when login token is expired/invalid after few days/hours)

May I know how to achieve so. Any code example is appreciated.

asrivas commented 6 years ago

Hi Yan Cheng, we do not have a sample ready for you but in the meantime you can read the documentation here for creating a background service: https://developer.android.com/training/run-background-service/create-service

If you're using Kotlin, here's a related sample: https://github.com/googlesamples/android-JobScheduler

parmarravi commented 5 years ago

@yccheok Have you got any solution to do this?