androidgoogle-drive-android-api

Google drive api with one user account for different devices


I am working with google drive API to backup and restore my SQLite database. All works perfect. But now i have a problem.

For example a user with id xyz@gmail.com login from two different devices to access my app. Now if both the device runs simultaneously only last device update will be saved on drive.

How can i restrict user to use only one google account per device? For ex. i have xyz@gmail account and i use this account with two devices.

How can i handle this? Please guide me.


Solution

  • When the user connect with his account, you set a boolean to false in db, when he disconnect/leave the app you set the boolean to true.

    When he log in, you check the value of the boolean, if true he can connect, otherwise you block him.