在我的应用程序中打开特定文件类型
Open a certain file type in my app
我的应用程序生成 .smbf 文件,当用户想要使用文件管理器应用程序打开这些文件时,我想选择在我的应用程序中打开这些文件。
搜索后我找到了一种使用 Intent 过滤器的方法,这是我的代码:
[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
{..}
以及生成的清单:
<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>
但是我的应用程序没有显示在可以打开 *.smbf 文件的应用程序列表中。 (使用 solid 和 es 文件浏览器测试)
还有什么需要我做的吗?
我的应用程序生成 .smbf 文件,当用户想要使用文件管理器应用程序打开这些文件时,我想选择在我的应用程序中打开这些文件。 搜索后我找到了一种使用 Intent 过滤器的方法,这是我的代码:
[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
{..}
以及生成的清单:
<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>
但是我的应用程序没有显示在可以打开 *.smbf 文件的应用程序列表中。 (使用 solid 和 es 文件浏览器测试) 还有什么需要我做的吗?