1

I am working with the task that selected Google drive file has update into the data base. Here my back end team needs Selected Google drive file id for downloading the file. Downloading process has followed by back end team. In android app side just i have to send the File id.

Once click the File add button File Chooser dialogue has viewed by using below code.

File Chooser dialogue Code:

private void showFileChooser1() {
        Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
        intent.setType("*/*");
        intent.addCategory(Intent.CATEGORY_OPENABLE);
       try {
             startActivityForResult(
                    Intent.createChooser(intent, "Select a File to Upload"),
                    FILE_SELECT_CODE);

        } catch (android.content.ActivityNotFoundException ex) {
        }

    }

Activity Result code:

 public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
         if (resultCode == RESULT_OK) {
            if (requestCode == FILE_SELECT_CODE) {
                fileData=data.toString();
                importFile();
            }
        } 
    }

In above code by using fileData i tried to get the File id.

 DriveId driveId = (DriveId) fileData.getParcelableExtra(OpenFileActivityBuilder.EXTRA_RESPONSE_DRIVE_ID);

But there getParcelableExtra is not working. Kindly please let me know the how to get the Drive file ID from selected Drive file Uri?

karthik
  • 321
  • 1
  • 8
  • 21
  • Can you post the error log? You may also check this [thread](http://stackoverflow.com/questions/19215661/getparcelableextra-always-null-on-pending-intent-but-not-intent). – abielita Mar 07 '17 at 06:43

0 Answers0