title: How to associate Android app with Google Drive files having particular extension?
body: <p>I need to associate files with particular extension from Google Drive (.gpx, for example) with my app. So when I click the .gpx file on Drive, I should have an option to open this file with my application.</p>
  
  <p>Currently I have an activity handling these files clicking declared in AndroidManifest.XML in a way below, and it works for locally stored files and gmail attachments, but not for Drive:</p>
  
  <pre><code> &lt;activity
              android:name=".ui.PhotosActivity"
              android:label="@string/app_name"
              android:launchMode="singleTop"
              &gt;
  
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN"/&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER"/&gt;
              &lt;/intent-filter&gt;
  
              &lt;intent-filter
                  android:icon="@drawable/ic_launcher"
                  android:label="@string/app_name"
                  android:priority="1"&gt;
                  &lt;action android:name="android.intent.action.VIEW"/&gt;
                  &lt;category android:name="android.intent.category.DEFAULT"/&gt;
                  &lt;category android:name="android.intent.category.BROWSABLE"/&gt;
  
                  &lt;data android:scheme="http"/&gt;
                  &lt;data android:scheme="https"/&gt;
                  &lt;data android:scheme="ftp"/&gt;
                  &lt;data android:scheme="file"/&gt;
                  &lt;data android:host="*"/&gt;
                  &lt;data android:mimeType="*/*"/&gt;
                  &lt;data android:pathPattern=".*\\.gpx"/&gt;
              &lt;/intent-filter&gt;
  
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.VIEW"/&gt;
  
                  &lt;action android:name="com.google.android.apps.drive.DRIVE_OPEN" /&gt;
  
                  &lt;category android:name="android.intent.category.BROWSABLE"/&gt;
                  &lt;category android:name="android.intent.category.DEFAULT"/&gt;
  
                  &lt;data
                      android:mimeType="application/octet-stream"
                      android:pathPattern=".*\\.gpx"
                      android:scheme="file"/&gt;
                  &lt;data
                      android:mimeType="application/octet-stream"
                      android:pathPattern=".*\\.gpx"
                      android:scheme="content"/&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  </code></pre>