So I managed to get my app to open files with a specific extension from file managers, but is it possible for users to tap on the file in Google Drive and have it open in the same way? I mean I know it's possible, other apps do it but what would be the steps to do this? I'm not interested in my app being able to manipulate files on Google Drive in any way, just to have Google Drive "send" the files to my app the way file managers do.
This is the intent filter I'm using now, but it doesn't work for files in Google Drive:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<action android:name="com.google.android.apps.drive.DRIVE_OPEN" />
<data android:scheme="file" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.xz9" />
<data android:host="*" />
</intent-filter>
content:
scheme, for starters. You might also see if there is any particular logging from the Drive app, at the time you request to do something with an.xz9
file, that gives you an idea what the fullUri
is, to see if the file extension is on there. – CommonsWarecontent:
scheme is and a Google search returns something that looks crazy complicated for such a simple action. – TimSimProjectorLaunchActivity
) of the Google Docs app. Strangely, there is noUri
there, which I had expected. "I don't know what a content: scheme" -- that would be an alternative forfile:
,http:
,https:
, etc. It refers to content published by aContentProvider
, which is where everything will be moving in the future. – CommonsWare<intent-filter>
forVIEW
,content:
, and a MIME type of*/*
, and see if Drive recognizes you. If so, you can examine theIntent
that you get, and then see if you can come up with a more constrained<intent-filter>
. – CommonsWare