0
내 Google 드라이브에 Android 앱을 사용했습니다. 그건 그렇고, 내가 만든 파일과 폴더 만 얻을 수 있습니다.
다른 장치 (또는 drive.google.com 사이트 자체)에 폴더와 파일을 만든 경우 파일과 폴더를 저장할 수 없습니다.새 Android Google 드라이브의 다른 기기에서 만든 폴더를 가져올 수 없습니다.
이 라인에서 봐 내 코드
public void loadRootFile()
{
constant.showProgress(getActivity(), "Loading...");
DriveFolder folder = Drive.DriveApi.getRootFolder(mGoogleApiClient);
folder.listChildren(mGoogleApiClient)
.setResultCallback(metadataResult);
Drive.DriveApi.requestSync(mGoogleApiClient)
.setResultCallback(new ResultCallback<Status>() {
@Override
public void onResult(Status result) {
if (!result.isSuccess()) {
// Sync not ok
showMessage("Sync error");
return;
}
}
});
}
final private ResultCallback<MetadataBufferResult> metadataResult = new
ResultCallback<MetadataBufferResult>() {
@Override
public void onResult(MetadataBufferResult result) {
vGoogleList.onRefreshComplete();
constant.hideProgress();
if (!result.getStatus().isSuccess()) {
showMessage("Problem while retrieving files");
return;
}
mGoogleList = new ArrayList<SCGoogleDrive>();
MetadataBuffer list = result.getMetadataBuffer();
for(int i=0;i<list.getCount();i++)
{
if(!list.get(i).getTitle().equals(""))
{
SCGoogleDrive item = new SCGoogleDrive(list.get(i), false);
mGoogleList.add(item);
}
}
showFiles(false);
}
};
@Override
public void onResume() {
super.onResume();
constant.showProgress(mActivity, "Loading...");
if (mGoogleApiClient == null) {
mGoogleApiClient = new GoogleApiClient.Builder(getActivity())
.addApi(Drive.API)
.addApi(Plus.API)
.addScope(Drive.SCOPE_FILE)
.addScope(Drive.SCOPE_APPFOLDER) // required for App Folder sample
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
}
mGoogleApiClient.connect();
}
@Override
public void onPause() {
if (mGoogleApiClient != null) {
mGoogleApiClient.disconnect();
}
super.onPause();
}
@Override
public void onConnectionFailed(ConnectionResult result) {
constant.hideProgress();
Log.i(TAG, "GoogleApiClient connection failed: " + result.toString());
if (!result.hasResolution()) {
// show the localized error dialog.
GooglePlayServicesUtil.getErrorDialog(result.getErrorCode(), getActivity(), 0).show();
return;
}
try {
result.startResolutionForResult(getActivity(), REQUEST_CODE_RESOLUTION);
} catch (SendIntentException e) {
Log.e(TAG, "Exception while starting resolution activity", e);
}
}
@Override
public void onConnected(Bundle arg0) {
// TODO Auto-generated method stub
constant.hideProgress();
showMessage("API client connected.");
if(mIsLogout)
{
logoutToGoogle();
}else
{
loadRootFile();
constant.gGoogleLogin = true;
mActivity.loginState();
saveLoginState();
}
}
@Override
public void onConnectionSuspended(int arg0) {
// TODO Auto-generated method stub
constant.hideProgress();
showMessage("GoogleApiClient connection suspended");
}
확인해주세요. http://stackoverflow.com/questions/27714031/authorizing-the-google-drive-android-api/27714094#27714094 – Wonil