简体   繁体   English

如何从我的PhoneGap应用程序打开另一个iOS应用程序?

[英]How to open another iOS app from my PhoneGap app?

I have a PhoneGap application, which needs to communicate with an external iOS app on the same device. 我有一个PhoneGap应用程序,该应用程序需要与同一设备上的外部iOS应用程序通信。 The external app will do some special processing, and return a unique value back to my PhoneGap app. 外部应用程序将进行一些特殊处理,并将唯一值返回给我的PhoneGap应用程序。 PhoneGap app then uses this unique value to do some processing internally. 然后,PhoneGap应用程序使用此唯一值在内部进行一些处理。

Given this use case, I have two questions 给定这个用例,我有两个问题

  1. How do I open another iOS app from a PhoneGap app? 如何从PhoneGap应用程序打开另一个iOS应用程序?
  2. How do I return to the PhoneGap app with some data from the external app 如何使用外部应用程序中的一些数据返回到PhoneGap应用程序

I have searched so far, but haven't found very relevant documentation. 到目前为止,我已经搜索过,但是没有找到非常相关的文档。 I have also tried to open another app using appname:/// strategy, hasn't worked for me. 我也尝试过使用appname:///策略打开另一个应用程序,但对我来说不起作用。

Any help will be appreciated. 任何帮助将不胜感激。 thank you! 谢谢!

Cordova has wide range of plugins for performing different operations. 科尔多瓦有许多用于执行不同操作的插件。 For opening external application you can use: https://github.com/lampaa/com.lampa.startapp 要打开外部应用程序,您可以使用: https : //github.com/lampaa/com.lampa.startapp

If you want to open an application without using any plugin: 如果要不使用任何插件打开应用程序:

var iOS_specificUrl = 'custom_url_scheme://url-to-reach?parameter1=val1';
window.location = iOS_specificUrl;

or you can use inappbrowser 或者您可以使用inappbrowser

var iOS_specificUrl = 'custom_url_scheme://url-to-reach?parameter1=val1';
window.open(iOS_specificUrl, '_system');

Let's say you have app1 and want to open app2 then you need to assign custom url to app2 and for that you need to make changes in app2 configuration xml file; 假设您有一个app1,并且想要打开app2,那么您需要为app2分配自定义网址,为此,您需要在app2配置xml文件中进行更改; and to do this you can use following plugin: https://github.com/EddyVerbruggen/Custom-URL-scheme 为此,您可以使用以下插件: https : //github.com/EddyVerbruggen/Custom-URL-scheme

Or if you want to open third party application then you need to get in touch with application provider for getting custom url. 或者,如果您想打开第三方应用程序,则需要与应用程序提供商联系以获取自定义网址。

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

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