Open another app from my app

0
Hi, does anyone has experience with opening another app from your Mendix app and vice versa? 
asked
3 answers
9

I use deeplinks with return urls as parameters(decoded) so you know if you are done in the app the user can navigate back (also often a deeplink)

 

Desktop/Browser:

1. App A: compose a URL for App B and include the return (deeplink)URL (which is the encoded url of App A).

2. Redirect to App B with the URL Redirector widget. 

3. If the user is done with his work in App B you can redirect him back to the return (deeplink)URL (App A). First decode this one

 

For Mobile slightly more complex; 

You have to include a custom schema to your config.xml so your mobile app is listing to YOURGREATAPP://

 

 <gap:plugin name="cordova-plugin-customurlscheme" source="npm" version="4.2.0">
        <param name="URL_SCHEME" value="YOURGREATAPP" /> 
    </gap:plugin>

Now your mobile app responses in for example e-mails of other apps by YOURGREATAPP://yourappname.mendixcloud.com/link/deeplinkname/deeplinkaparam 


Add some more java script code in the index.html of your phonegap package. This function is called by cordova when opening the app so you can execute the deeplink:


 function handleOpenURL(url) {
    setTimeout(
        function(){
            if (!url.match(("^(http:\/\/|https:\/\/)+.*$"))) {
                url = window.mx.remoteUrl + url.replace('^((.+)\:\/\/)?', '');
            }
            var oReq = new XMLHttpRequest();
            // false = acync -> should be called AFTER setting deeplink
            oReq.open("get", url, false);
            oReq.send();

            //detect if iOS for handle deeplink
            if (device.platform === 'iOS')
            {
                window.location.reload(false);
            }
        }
    ,1);
}

 

answered
0

Hi All,

I have some queries related to above answer:-

1. what is "YOURGREATAPP" name is coming from. Do I create any random name or I have to take this name from some place from our application.

2. when I sent this kind of URL by mail to my personal mail ID after updating all the required things in below URL entered and want to open the link it gives me "500 error".  

YOURGREATAPP://yourappname.mendixcloud.com/link/deeplinkname/deeplinkaparam 

 

 

 

answered
0

Need to add like this

app1:

config.xml

index.html

At app1 client add this:

<button onclick="window.open('app2://android-app2-sandbox.mxapps.io/link/App2/', '_system')">Open Button</button>

 

App2:

config.xml:

index.html

 

 

answered