我遇到了驅動器中的問題。我無法導入它。我得到的錯誤是DriveScopes
無法解析爲變量。無法導入驅動器
private ProgressBar progressBar;
private Context context;
private static Uri callLogFileUri;
private static Uri smsLogFileUri;
private static Drive service;
private boolean callLogs;
private boolean smsLogs;
private String address;
private ContentResolver cr;
private GoogleAccountCredential credential;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.backup_layout);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
progressBar.setVisibility(View.VISIBLE);
context = this;
Intent intent;
cr = getContentResolver();
credential = GoogleAccountCredential.usingOAuth2(this,DriveScopes.DRIVE);
try {
intent = getIntent();
if (intent.hasExtra("fromReceiver")) {
address = intent.getStringExtra("fromReceiver");
Log.i(TAG, "Backup intent from receiver");
recoverData();
} else {
Log.i(TAG, "Backup intent from elsewhere");
DialogFragment dialog = new BackupAccountsDialogFragment();
dialog.show(getFragmentManager(),
"BackupAccountsDialogFragment");
}
} catch(Exception e) {
recoverData();
}
}
@Override
protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
switch (requestCode) {
case REQUEST_ACCOUNT_PICKER:
if (resultCode == RESULT_OK && data != null && data.getExtras() != null) {
final String accountName = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);
if (accountName != null) {
Log.i(TAG, "REQUEST ACCOUNT PICKER");
credential.setSelectedAccountName(accountName);
service = getDriveService(credential);
storeGoogleAccounts(accountName);
Log.i(TAG, "Account saved: " + CHOSEN_GOOGLE_ACCOUNT + " " + accountName);
getFirstAuthInAsync();
}
'Drive service' does compile? – greenapps 2014-12-13 09:52:23