0

My xamarin.forms app works with sqlite3 files which have the extension .rde, and I want people to be able to open .rde files from the files app, downloaded from the browser etc., with an implicit intent.

I've followed this tutorial and modified the intent to match my extension:

namespace myapp.Droid
{
    [Activity(Label = "myapp", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    [IntentFilter(new[] { Intent.ActionEdit }, Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable }, DataPathPattern = ".*\\.rde", DataSchemes = new[] { "file", "content" }, DataHost = "*", DataMimeType = "*/*")]
    //...
}

This doesn't appear to be sufficient. When I install this app on my device and try to open a downloaded .rde file, the files app shows an alert "Search the Play Store? You don't have any apps that can open this type of file." What do I need to change to register this intent with the .rde file type, or how can I diagnose why Android doesn't match my intent in this case?

Graham Lee
  • 295
  • 4
  • 8
  • Maybe you need Intent.ActionView? – blackapps Mar 08 '21 at 11:17
  • Thank you @blackapps, unfortunately adding that action didn't change the outcome. – Graham Lee Mar 08 '21 at 12:16
  • `DataMimeType = "*/*"` DataMimeType = "*/rde" ? – blackapps Mar 08 '21 at 12:27
  • DataPathPattern = ".*\\.rde" Mostly you need more of them to allow for files in sub-sub-subdirectories and so. – blackapps Mar 08 '21 at 12:29
  • @blackapps I don't understand why your other proposed changes would help. I don't think there _is_ any mime type matching `*/rde`, and I don't see how the regex `.*\\.rde` _doesn't_ already match the path separator. – Graham Lee Mar 08 '21 at 12:32
  • 1
    I dont know that. But have a look here https://stackoverflow.com/questions/16490907/intent-filters-and-androidpathpattern/16491465 And sorry i cannot find the other intent filters i saw before and have in mind. – blackapps Mar 08 '21 at 12:41
  • Great, thanks I'll check out the other question – Graham Lee Mar 08 '21 at 12:53
  • That question is about how to match paths of a particular depth. I don't have that problem; I have the problem that my intent is not being triggered despite matching the path regex. – Graham Lee Mar 08 '21 at 13:59

1 Answers1

0

It looks like I'm not permitted to access those intents, and instead should be using the storage access framework. This sample shows how it's done in Kotlin, and I'm using the dependency service in Xamarin.Forms to invoke a C# rewrite of that.

Graham Lee
  • 295
  • 4
  • 8