I tried to share the audio files to google drive by using the below method.Is it possible to share file to google drive by using Intent.createChooser() method and also any permissions to be added in the Androidmanifest file. The error was i can't share the file to google drive.Please help me to solve this problem.
Uri uri = Uri.parse(MEDIA_PATH);
Intent share = new Intent(Intent.ACTION_SEND);
share.putExtra(Intent.EXTRA_STREAM, uri);
share.setType("audio/*");
share.setPackage("com.google.android.apps.docs");
share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(share, "Share audio File"));
I don't think you can do it like that. First you need to setup your Android to for Drive API. Then check the Creating Files docs to know about creating files.
"You can create files in two ways with the Drive Android API: using the CreateFileActivityBuilder class, or using the createFile() method of the DriveFolder interface"
Here's an Drive Android demo for your code reference.