android - 在 Cordova 应用程序中获取额外功能

标签 android cordova extras

我们有两个 Android 应用程序:一个使用 native Java 实现,另一个使用 Ionic 编写。 Ionic 应用程序启动我的应用程序,它是使用 lampaa plugin 的 Android 应用程序.我可以使用以下代码接收 Ionic 应用程序提供的额外功能:

String keyid = getIntent().getStringExtra("keyid");

在我退出我的应用程序之前,我想向 Ionic 应用程序发送额外的内容。这很容易从 Android 端完成。 Ionic 应用程序如何知道我的应用程序已将控制权转移给它,以及它如何检索我已发送的额外内容?

最佳答案

我认为在您的情况下,要从您的 native 应用程序中获得额外功能,您需要使用其他插件,例如 cordova-plugin-intent .

例如:

    //To get the intent and extras when the app it's open for the first time
    window.plugins.intent.getCordovaIntent (function (intent) {
        intenthandler(intent);
    });

    //To get the intent and extras if the app is running in the background
    window.plugins.intent.setNewIntentHandler (function (intent) {
        intenthandler(intent);
    });

    //To handle the params
    var intenthandler = function (intent) {
          if (intent && intent.extras && intent.extras.myParams) {
        //Do something
          }
    };

如需更多帮助,请查看 here .

希望对您有所帮助!!

关于android - 在 Cordova 应用程序中获取额外功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39218893/

相关文章:

android - 服务堆栈的基本身份验证

javascript - 无法使用我的phonegap应用程序连接到mysql服务器

android - 更新有序的 BroadcastReceiver android 之间的 Intent extras

android - 在android中动态更改SVG图像颜色

java - 如何在 Android 中使用循环数据创建 JSON 数组

java - 我应该在 Spring 和 Android 中使用一种 Java 模型表示吗?

JQuery 移动应用 - 表单安全问题

jquery - Phonegap - 在仍然启用自动定向的同时防止旋转?

Android:我的部分临时 Actor 在未决 Intent 中迷失了

android - 将用户定义对象的数组列表传递给 Intent android