0

I have an app that's supposed to handle my custom data-type .xyz. I'm currently using the intent filter:

[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault }, DataMimeType = "application/*", DataPathPattern = "*.xzy")]  

On a Pixel 2 with Android 9.0 GMail automatically opens .xyz files when I click on that attachment. Unfortunately, my app also receives .doc files which it can't handle appropriately.

How do look at the MimeType that gets passed to me by an app like GMail to see which mimetype was passed for to me that I can filter less general?

Christian
  • 25,249
  • 40
  • 134
  • 225
  • you could do here is associate with "application/octet-stream", but that's not really a good user experience either.you couldn't rely on it being set correctly – Leo Zhu Apr 18 '19 at 09:08
  • @LeoZhu-MSFT : When I set `application/octet-stream` I can't open the files from Gmail. Gmail seems to use something else. – Christian Apr 18 '19 at 09:35
  • you could look at this link,maybe you could get some ideas:https://stackoverflow.com/questions/8148629/intent-filter-to-download-attachment-from-gmail-apps-on-android – Leo Zhu Apr 18 '19 at 09:37

1 Answers1

0

I found that I can log this information via:

Log.Debug(TAG, "Mimetype:'" + Intent.Type + "'");
Christian
  • 25,249
  • 40
  • 134
  • 225