gpt4 book ai didi

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

转载 作者:搜寻专家 更新时间:2023-11-01 07:48:20 27 4
gpt4 key购买 nike

我们有两个 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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com