Share/Send Files to Google Drive via share-button - Android
ArrayList<Uri> fileURIs = [ uris of files in mobile device ]
Intent shareIntent = new Intent();
shareIntent.setAction( Intent.ACTION_SEND_MULTIPLE );
shareIntent.putExtra( Intent.EXTRA_SUBJECT, [ subject text ] );
shareIntent.putExtra( Intent.EXTRA_TEXT, [ contents text ] );
shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, fileURIs );
shareIntent.setType( "text/*" ); // set the type you want
// Google Drive package name : com.google.android.apps.docs
shareIntent.setPackage("com.google.android.apps.docs");
// It will start the Google Drive APP.
activity.startActivity( shareIntent );
Intent shareIntent = new Intent();
shareIntent.setAction( Intent.ACTION_SEND_MULTIPLE );
shareIntent.putExtra( Intent.EXTRA_SUBJECT, [ subject text ] );
shareIntent.putExtra( Intent.EXTRA_TEXT, [ contents text ] );
shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, fileURIs );
shareIntent.setType( "text/*" ); // set the type you want
// Google Drive package name : com.google.android.apps.docs
shareIntent.setPackage("com.google.android.apps.docs");
// It will start the Google Drive APP.
activity.startActivity( shareIntent );
留言
張貼留言