Search code examples
androidxamarinandroid-intentintentfilter

Xamarin Android complete action with


I have created an app which is almost finished. When browsing your files using Samsung MyFiles app or whatever, you have to be able to click on a file and open the "complete action with/open with" dialog with my app in the list of available apps. How do I get my app in that list?

Can someone help by pointing me in the right direction at least?

Thanks!

Kevin


Solution

  • Try this:

    [Activity (Label = "MyApp", MainLauncher = true, Icon = "@drawable/icon")]
    [IntentFilter (new string[] {Intent.ActionView}, 
                  Categories=new string[] { Intent.CategoryDefault, Intent.CategoryBrowsable },  
                  DataScheme="file", 
                  DataHost="*", 
                  DataMimeType="*/*", 
                  DataPathPattern=".*\\\\.abc")]  
    
    public class MainActivity : Activity 
    {
      your activity's code here...
    }
    

    Where .abc is the file extension you want to open with your app.