简体   繁体   English

如何在IOS共享菜单中显示我的cordova应用程序?

[英]How to show my cordova app in IOS share menu?

We have an existing Cordova iOS App for which we need an iOS share extension which will allow Users to to share files from other apps (like Photos, Pages, Numbers, Keynote, etc) with our App (ie Export file from Pages to our App). 我们有一个现有的Cordova iOS应用程序,我们需要一个iOS共享扩展,允许用户使用我们的应用程序共享来自其他应用程序(如照片,页面,数字,主题演讲等)的文件(即从Pages导出文件到我们的应用程序) )。

We need the following delivered: 我们需要提供以下服务:

  • Prototype / Sample iOS Cordova App 原型/示例iOS Cordova App
  • with a share extension setup up for jpg, png, video, pdf and office (xls, xlsx, doc, docx, ppt, pptx) files 为jpg,png,video,pdf和office(xls,xlsx,doc,docx,ppt,pptx)文件设置共享扩展
  • Extension to either open the Cordova App directly OR to open the Cordova App as a webview inside the share widget 扩展为直接打开Cordova应用程序或在共享小部件内打开Cordova应用程序作为webview
  • Cordova App must receive parameters about the shared file (filename, path, type, filesize) from extension - the handling of the file afterwards will be done by us. Cordova App必须从扩展程序接收有关共享文件(文件名,路径,类型,文件大小)的参数 - 之后对文件的处理将由我们完成。
  • Documentation on how to implement this functionality (share extension) in our existing Cordova App (steps necessary to perform in Xcode etc) 有关如何在我们现有的Cordova应用程序中实现此功能(共享扩展)的文档(在Xcode等中执行所需的步骤)

I think you could find a solution here . 我想你可以在这里找到解决方案。 It is not clear, but it seems to work. 目前尚不清楚,但似乎有效。

有一个跨平台的cordova插件(iOS和Android)可实现: https//github.com/j3k0/cordova-plugin-openwith

That's a good and still relevant question. 这是一个很好且仍然相关的问题。

I tried to make use of the awesome cordova-plugin-openwith by Jean-Christophe Hoelt but faced several issues. 我试图利用Jean-Christophe Hoelt的令人敬畏的cordova-plugin- openwith但面临几个问题。 The plugin is meant to receive share items of one type (say, URL, text or image), which is configured during installation. 该插件用于接收在安装期间配置的一种类型的共享项(例如,URL,文本或图像)。 Also, with its current implementation, writing a note to share and selecting a receiver in a Cordova app are two different steps in different (native and Cordova) context, so it didn't look as a good user experience to me. 此外,通过其当前实现,在Cordova应用程序中编写共享和选择接收器的注释是不同(本机和Cordova)上下文中的两个不同步骤,因此它对我来说看起来不是一个好的用户体验。

I made these and other corrections to this plugin and published it as a separate plugin: https://github.com/EternallLight/cordova-plugin-openwith-ios 我对此插件进行了这些和其他更正,并将其作为单独的插件发布: https//github.com/EternallLight/cordova-plugin-openwith-ios

Note that it works only for iOS, not for Android. 请注意,它仅适用于iOS,不适用于Android。

There are few links which could be helpful even if you do not want to use open with plugin 即使您不想使用open with plugin,也很少有链接可能会有所帮助

https://irace.me/tumblr-ios-extension https://irace.me/tumblr-ios-extension

http://engineering.curalate.com/2017/03/09/ios-share-ext-with-ionic.html http://engineering.curalate.com/2017/03/09/ios-share-ext-with-ionic.html

In android editing, the manifest worked fine for me. 在android编辑中,清单对我来说很好。 I had to add one more java file added in some already added plugin like below in plugin.xml. 我不得不在plugin.xml中添加一些已添加的插件中添加的java文件,如下所示。 Which in turn added in the manifest. 反过来又在清单中添加了。

            <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="image/*" />
                <data android:mimeType="application/pdf"/>
                <data android:mimeType="application/msword"/>
                <data android:mimeType="application/mspowerpoint"/>
                <data android:mimeType="application/powerpoint"/>
                <data android:mimeType="application/vnd.ms-powerpoint"/>
                <data android:mimeType="application/x-mspowerpoint"/>
                <data android:mimeType="application/excel"/>
                <data android:mimeType="application/vnd.ms-excel"/>
                <data android:mimeType="application/x-excel"/>
                <data android:mimeType="application/x-msexcel"/>
                <data android:mimeType="application/vnd.openxmlformats-officedocument.wordprocessingml.document"/>
                <data android:mimeType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"/>
                <data android:mimeType="application/vnd.openxmlformats-officedocument.presentationml.presentation"/>
            </intent-filter>
        </activity>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM