EDIT: I am gong to rephrase the question, how can I make my Xamarin Forms app show up in the list of available apps when the user clicks on a browse button in a webpage, such as images.google.com, or Facebook (post or comment)? I seem to have the general idea right, I know I need an intent to do it, but I cannot find the action or category combination that produces the correct result. Please assist.
I have a Xamarin Forms app that has 3 sections, the default Launcher which opens when you click on the app icon, which works perfectly, then I have an image manager section that launches from this intent...
[Activity(MainLauncher = false, NoHistory = true, Icon = "@drawable/icon", Theme = "@style/LaunchTheme",
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
[IntentFilter(
new[] { Intent.ActionView },
Categories = new[]
{
Intent.CategoryDefault,
Intent.CategoryBrowsable,
},
DataScheme = "file",
DataMimeType = "*/*",
DataPathPattern = ".*\\.jpg"
)]
Once the image has been edited it can be saved to a library within the app (this is actually a SQL database backed by Azure storage). Now what I would like to do is have the third section, a library of all managed images, be in the options when you click on a browse for file button in a webpage. Currently my device shows Gallery, and Prime Photos as options, what should the intent look like to enable this to happen?
Thanks Shaine.
EDIT: At this point I am aware that I need to make the IntentFilter into Intent.ActionGetContent, something like...
[Activity(MainLauncher = false, NoHistory = true, Icon = "@drawable/icon", Theme = "@style/LaunchTheme",
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
[IntentFilter(
new[] { Intent.ActionView },
Categories = new[]
{
Intent.CategoryDefault,
Intent.CategoryBrowsable,
Intet.CategoryOpenable
},
DataScheme = "file",
DataMimeType = "image/*"
)]
However, I am not sure what the next step is, and the Xamarin docs on this are rare, if they even exist. Any help appreciated.
And the answer is...
[IntentFilter(new[] { Intent.ActionView, Intent.ActionPick, Intent.ActionGetContent }, Categories = new[] { Intent.CategoryDefault, Intent.CategoryOpenable }, DataMimeType = @"image/*")]
Thanks
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.