Opening a Google Doc file with Google Drive on Android

I cannot pass the link Google docs file

to Google Drive App

on Android.

Is it possible to open a Google Drive file in the Android Google Drive app by passing a link through an intent?

Private void open(){
  String link = "https://docs.google.com/file/d/"+FILE_ID;
  Uri path = Uri.parse(link);
  Intent intent = new Intent(Intent.ACTION_VIEW);
  intent.setDataAndType(path, MIME_TYPE);
  intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  try {
       startActivity(intent);
      } catch (Exception e) {
    showMessage(e.getMessage());
     }
      }

      

+3


source to share





All Articles