简体   繁体   中英

Managing files on Google Drive in my Android app

I really need help, I already spend two days trying to add google drive to my app but I don't get how it goes, there's a lot of information on internet but a lot of them seems to be outdated and google Getting Started guide is not that clear about the process, I followed up this https://developers.google.com/drive/android/get-started , so I already have the Google Drive API configured on the console and got a ClientID for my android app, however, google never tells where to put that client ID, it just go straight to upload something, and I have tried that without success, so far, in my code, I just have created the GoogleSignIn private class that google tells you to do, but same thing goes, I don't get what to do with that.

This is the SignUp class:

private GoogleSignInClient buildGoogleSignInClient() {
        GoogleSignInOptions signInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestScopes(Drive.SCOPE_FILE)
                .build();

        return GoogleSignIn.getClient(getContext(), signInOptions);

So my main questions are:

Where do I setup my clientID? Where do I select which google account I'm going to use to connect to drive? My objective is to look for X file on drive, if it exist, download it, edit it, and then upload it again, the type of file is a .csv

Please, do not tell me just to go to google developers to read their documentation as I found those pretty bad on explaining things

Based from this SO post , you must set your ClientID in the manifest under the <application> tag:

<meta-data
    android:name="com.google.app.id"
    android:value="app ID from your API console"/>

It says that once this entry is in the manifest, then when the app uses the Google Drive REST API to interact with Google's servers, the transaction is correctly logged as traffic in your app's console.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM