Integrate Google Drive
To integrate Google Drive with your Fire OS app, you must first integrate with the A3L Authentication SDK and implement the sign-in feature. For instructions, see Integrate A3L Authentication SDK. Add the Google Drive SDK as a dependency in your app’s build.gradle file, as shown here.A3LSignInOptions object, request the appropriate scopes for Google Drive through the requestScopes() method, as shown in the following code.
Create credentials
After signing in the user, create credentials for Google Drive with anFOSAccountCredential object. When you create the object, pass the same scope that you passed for the A3LSignInOptions, as shown in the following example.
Drive object with Google Drive API calls. The following code shows how to use the Drive object, and list the name and IDs of up to 10 files.
Class differences
The following table lists the differences between the available methods inGoogleAccountCredential and FOSAccountCredential classes.
| API | Available in GoogleAccountCredential | Available in FOSAccountCredential |
|---|---|---|
static usingAudience(Context context, String audience) | Yes | No |
static usingOAuth2(Context context, Collection<String> scopes) | Yes | Yes |
Constructor (Context context, String scope) | Yes | Yes |
getAllAccounts() | Yes | Yes Returns only the account that was used to sign in |
getBackOff() | Yes | Yes |
getContext() | Yes | Yes |
getGoogleAccountManager() | Yes | No |
getScope() | Yes | Yes |
getSelectedAccount() | Yes | Yes |
getSelectedAccountName() | Yes | Yes |
getSleeper() | Yes | Yes |
getToken() | Yes | Yes |
initialize(HttpRequest request) | Yes | Yes |
newChooseAccountIntent() | Yes | No |
setBackOff(BackOff backOff) | Yes | Yes |
setSelectedAccount(Account selectedAccount) | Yes | Yes |
setSelectedAccountName(String accountName) | Yes | Yes |
setSleeper(Sleeper sleeper) | Yes | Yes |

