Android Cordova将文件类型注册到';用'打开;列表

Android Cordova将文件类型注册到';用'打开;列表,android,ios,cordova,mobile,ionic-framework,Android,Ios,Cordova,Mobile,Ionic Framework,我想注册我的Ionic应用程序(通过Cordova)来打开某些文件类型。就像Dropbox一样。当用户在另一个应用程序(如电子邮件)上有一个文件,并单击“打开方式”时,会出现一个包含Dropbox应用程序的列表 以下是苹果公司的教程: 是否有任何Cordova插件支持Android和iOS,并为该功能提供JSAPI?提前感谢。您可以在Cordova中实现文件类型关联 它包括两个步骤 1) 将Android清单/iOS plist中的文件注册为 显示 <intent-filter a

我想注册我的Ionic应用程序(通过Cordova)来打开某些文件类型。就像Dropbox一样。当用户在另一个应用程序(如电子邮件)上有一个文件,并单击“打开方式”时,会出现一个包含Dropbox应用程序的列表

以下是苹果公司的教程:


是否有任何Cordova插件支持Android和iOS,并为该功能提供JSAPI?提前感谢。

您可以在Cordova中实现文件类型关联

它包括两个步骤

1) 将Android清单/iOS plist中的文件注册为

显示

<intent-filter
    android:icon='@drawable/ic_launcher'
        android:label='AndroidMHT File'
    android:priority='1'>
    <action android:name="android.intent.action.VIEW" />
    <action android:name="android.intent.action.EDIT" /> 
    <action android:name="android.intent.action.PICK" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:mimeType="*/*" />
    <data android:pathPattern="*.mht" />
</intent-filter>
<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="http" android:host="*" android:pathPattern=".*\\.mht" />
    <data android:scheme="https" android:host="*" android:pathPattern=".*\\.mht" />
</intent-filter>
<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:mimeType="message/rfc822" android:scheme="http" />
    <data android:mimeType="multipart/related" android:scheme="http" />
    <data android:mimeType="message/rfc822" android:scheme="https" />
    <data android:mimeType="multipart/related" android:scheme="https" />
</intent-filter>

您可能需要传递必要的标志才能打开这些文件

参考号:,以及

希望能有帮助

检查这个。 关于Let'sRefactor,除了fileopener之外,它是正确的,因此您应该确定当用户使用您的应用程序打开文件时要调用什么函数(当然是本机函数)。
上面的链接对此进行了详细解释。

感谢您的链接(我修复了Android的链接)。我还没有机会测试,但这似乎是正确的方法。实际的插件会更容易(比如注册URL方案),但我认为我可以使用钩子让脚本完成plist更改。好吧,“文件开启器插件”是不相关的,也就是说,它会让我的应用程序告诉操作系统打开其他人的文件,而这个问题只是关于确保其他应用程序(如电子邮件)可以将文件发送到我的应用程序。嗨,我如何在Web应用程序本身上获取文件地址?(一个用户按下照片上的打开按钮,现在他被转移到我的应用程序,下一步是什么?)有人能找到下一步抓取文件吗@DanielGolub?嗨,有人找到了完整的解决方案吗?你可以发布链接吗?
<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeIconFiles</key>
        <array>
            <string>Document-molecules-320.png</string>
            <string>Document-molecules-64.png</string>
        </array>
        <key>CFBundleTypeName</key>
        <string>Molecules Structure File</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSHandlerRank</key>
        <string>Owner</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.sunsetlakesoftware.molecules.pdb</string>
            <string>org.gnu.gnu-zip-archive</string>
        </array>
    </dict>
</array>