简体   繁体   中英

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. 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!

Cordova has wide range of plugins for performing different operations. For opening external application you can use: 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

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; and to do this you can use following plugin: 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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