简体   繁体   English

是否可以在 Cordova 中使用 App 操作

[英]is it possible to Use App actions with Cordova

Is it possible for App actions and intents to be used through Cordova?是否可以通过 Cordova 使用 App 操作和意图? I have a Cordova app and would like to utilize the App actions for android devices as conversational actions is being depreciated.我有一个 Cordova 应用程序,并希望将应用程序操作用于 android 设备,因为会话操作正在贬值。 would it be possible to make a Cordova plugin to do this, or is there a more simple approach?是否有可能制作一个 Cordova 插件来做到这一点,还是有更简单的方法?

thanks.谢谢。

This should be possible, after all, all you need to do is declare the app actions in shortcut.xml resource file of your Android app.这应该是可能的,毕竟,您需要做的就是在您的 Android 应用程序的快捷方式.xml 资源文件中声明应用程序操作。

<shortcuts>
    <capability android:name="actions.intent.ORDER_MENU_ITEM">
        <intent
            android:action="android.intent.action.VIEW"
            android:targetPackage="com.example.app"
            android:targetClass="com.example.app.browse">
            <parameter
                android:name="menuItem.name"
                android:key="query">
            </parameter>
        </intent>
    </capability>

Now you probably need to craft a small plugin so that the values here现在您可能需要制作一个小插件,以便此处的值

 android:action="android.intent.action.VIEW"
 android:targetPackage="com.example.app"
 android:targetClass="com.example.app.browse"

Are overwritten by Cordova and point to the proper package and class, and also be able to callback some JS so your app can go to the proper "page".被 Cordova 覆盖并指向正确的包和类,并且还能够回调一些 JS,以便您的应用程序可以转到正确的“页面”。 But no, there is nothing available yet.但是,不,还没有任何可用的东西。

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

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