Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open custom file extension from google drive on android

I am struggling with how to make a custom file extension open in my android application through the google drive ui. My file currently opens fine through dropbox or the android file explorer. Google drive seems to only consider the mime type of the file. The file extension is my own (lets say .xyz) and the file is xml on the inside. I want the file to open in my app not just any app registered to open text/xml mime types. How can i tell google drive the .xyz files are not to be treated like text/xml. Similarly i don't want my app to be registered to open all text/xml files.

So the end user workflow would be this: 1) Open Google Drive android app. 2) Tap "somefile.xyz" -> The file would be opened in my app. Currently it opens in the google drive xml viewer. 3) Tap "otherfile.xml" -> The file would not be opened in my app.

like image 844
Nathan Avatar asked Oct 14 '12 17:10

Nathan


People also ask

How do you change a file extension in Google Drive?

However, there may be times when you want to choose a different format, such as PDF. Double-click the desired file to open it. The file will appear in a new tab. Select File > Download as, then choose the desired file type.

How do I get file extensions in Google Drive?

By right-clicking the web link to the document and picking Open with Google Drive Viewer from the pane that opens, the extension will load the linked document in the appropriate Google office app. (You may need to reload the browser tab to get the document to appear, particularly if it's a . ppt file.)

How do I associate a file type with an Android app?

Open File Manager and browse the the folder containing the files that you want to associate with a particular app. This will set the target file types to be opened with the selected app and open that file in that app as well. By the way doing things in Android is not too difficult.


1 Answers

Turns out the answer to this question is you can't do that.

With a file called .xyz and a format of xml on the inside the best you can do is to create various intent filters to handle all the ways other apps identify the file. For Example I put the following mimeTypes in my intent filters.

  • Google Drive - text/xml
  • ICS Gmail - text/plain
  • JellyBean Gmail - application/octet-stream
like image 89
Nathan Avatar answered Oct 22 '22 06:10

Nathan