android - Trouble with google drive -
i want create application browsing files in google drive located in root folder. problem can set permissions creating , browsing files. have browse files upload in google drive via browser.
@override protected void onresume() { super.onresume(); if (mgoogleapiclient == null) { mgoogleapiclient = new googleapiclient.builder(this) .addapi(drive.api) .addscope(drive.scope_file) .addscope(drive.scope_appfolder) // required app folder sample .addconnectioncallbacks(this) .addonconnectionfailedlistener(this) .build(); } mgoogleapiclient.connect(); }
to retrieve files root folder
use drive.getrootfolder
method.
the getrootfolder returns drivefolder
, can used interact root folder. method return synchronously, , safe invoke ui thread.
drivefolder folder = drive.driveapi.getfolder(getgoogleapiclient(), result.getdriveid()); folder.listchildren(getgoogleapiclient()) .setresultcallback(metadataresult);
public static final scope scope_file
scope gives 'drive.file' access user's drive. scope give per-file access files have been created by, or opened app.
the scope
implements safeparcelable
describes oauth 2.0 scope request. has security implications user, , requesting additional scopes result in authorization dialogs.
here's sample demo app, demo app illustrates possible ways talk drive service use of interfaces available in google play services: https://github.com/googledrive/android-demos/
Comments
Post a Comment