gonzobrains
gonzobrains

Reputation: 8036

Associate file extension with Xamarin Android application

I am trying to associate a custom file extension with my Xamarin-based Android application. I would like my application to open when the user chooses a particular type of file from the file manager.

My files use the extension ".label" but for some reason I cannot get Android to add my app to the chooser listen when selecting a file with such file extension.

However, if I use the ".xml" extension it seems to work. Here is the IntentFilter I am using:

[IntentFilter(new[] { Intent.ActionView, Intent.ActionEdit },
Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable },
DataScheme = "file",
DataHost = "*",
DataMimeType = "*/*",
DataPathPattern = ".*\\.xml")]

Upvotes: 2

Views: 1819

Answers (1)

gonzobrains
gonzobrains

Reputation: 8036

This ended up working for me:

[IntentFilter(new[] { Intent.ActionView, Intent.ActionEdit },
    Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable },
    DataScheme = "file", 
    DataHost = "*",     
    DataPathPattern = ".*\\\\.label")]

Upvotes: 4

Related Questions