How to open another iOS app from my PhoneGap app?

时间:2016-08-30 04:19:24

标签: ios cordova

I have a PhoneGap application, which needs to communicate with an external iOS app on the same device. The external app will do some special processing, and return a unique value back to my PhoneGap app. PhoneGap app then uses this unique value to do some processing internally.

Given this use case, I have two questions

  1. How do I open another iOS app from a PhoneGap app?
  2. How do I return to the PhoneGap app with some data from the external app

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.

Any help will be appreciated. thank you!

1 个答案:

答案 0 :(得分:2)

Cordova拥有广泛的插件,可用于执行不同的操作。 要打开外部应用程序,您可以使用:https://github.com/lampaa/com.lampa.startapp

如果您想在不使用任何插件的情况下打开应用程序:

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

或者您可以使用inappbrowser

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

假设您有app1并想要打开app2然后您需要为app2分配自定义网址,为此您需要在app2配置xml文件中进行更改;要做到这一点,你可以使用以下插件: https://github.com/EddyVerbruggen/Custom-URL-scheme

或者,如果您想要打开第三方应用程序,那么您需要与应用程序提供商联系以获取自定义URL。