1

My app generates .smbf files and I want to make an option to open these files in my app when user want to open them using file manager apps. After searching I found a way using intent filter and this is my code:

[Android.App.Activity(Label = "Setting", Theme = "@style/MyTheme", WindowSoftInputMode = SoftInput.StateHidden, Icon = "@drawable/Icon")]
[Android.App.IntentFilter(actions: new string[] { Intent.ActionView, Intent.ActionEdit }, Categories = new string[] { Intent.CategoryDefault }, DataPathPattern = @".*\\.smbf", DataHost = "*", DataScheme = "file")]
public class Setting : MyActivity
{..}

And the generated manifest:

<activity android:icon="@drawable/icon" android:label="Setting" android:theme="@style/MyTheme" android:windowSoftInputMode="stateHidden|adjustUnspecified" android:name="md5307edafcc42f816474105a485627044f.Setting">
  <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <action android:name="android.intent.action.EDIT" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:host="*" android:pathPattern=".*\\.smbf" android:scheme="file" />
  </intent-filter>
</activity>

But my app isn't shown in the list of apps that can open *.smbf file. (tested with solid and es file explorers) Is there anything more that I should do?

momvart
  • 1,737
  • 1
  • 20
  • 32

2 Answers2

1

My problem has been solved after I added mimeType attribute: DataMimeType = "*/*" android:mimeType="*/*

momvart
  • 1,737
  • 1
  • 20
  • 32
0

Are your files located in a path that contains periods? There's a long-standing problem with using pathPattern like this when there are periods somewhere in the full path. See my ancient question from 2010. Nothing has changed with this in 6 years, which is kind of sad.

https://stackoverflow.com/questions/3400072/pathpattern-to-match-file-extension-does-not-work-if-a-period-exists-elsewhere-i

Community
  • 1
  • 1
Robert Nekic
  • 3,087
  • 3
  • 24
  • 36