How to open external native app from android and iOS?

How to open external native app from android and iOS?
0.0 0

#1

Hi,

I would like to open an android or iOS app from another app.

For example,
FirstApp opens SecondApp. Both native for both iOS and Android. How to do this for Cocos Creator?

I’ve searched around the only thing similar is cc.sys.openUrl which opens a browser but I want to open a specific app.

Here are some reference to show what I’m trying to do from Native. Also, an example from another game engine.

In native Android example:

<activity
    android:name=".OtherAppActivity"
    android:label="@string/app_name" >
    <intent-filter>
        <action android:name="com.mycompany.DO_SOMETHING" />
    </intent-filter>
</activity>

Then, in the ‘calling’ app, use…

Intent intent = new Intent();
intent.setAction(“com.mycompany.DO_SOMETHING”);
context.startActivity(intent);

For iOS, a full example is here: https://stackoverflow.com/questions/419119/launch-an-app-from-within-another-iphone

In Unity, can do it like this https://forum.unity.com/threads/android-ios-launch-from-within-a-unity-app-another-unity-app.222709/


#2

UPDATE:

This might be a possible solution:
This google cached (Where is the real page? could not find it) page http://webcache.googleusercontent.com/search?q=cache:xnIx8danvjsJ:www.cocos2d-x.org/wiki/Invoking_Android_Java_methods_from_JavaScript+&cd=2&hl=en&ct=clnk&gl=hk&client=safari

For iOS:
http://webcache.googleusercontent.com/search?q=cache:nrUsAqm3QN4J:www.cocos2d-x.org/wiki/Invoking_Objective-C_methods_from_JavaScript+&cd=1&hl=en&ct=clnk&gl=hk

From the page above:
Using a feature that we can call Java static methods directly in js.

var o = jsb.reflection.callStaticMethod(className, methodName, methodSignature, parameters…)

My question is, does the info on the suggested page still apply? It says its 3 years old and if there is an updated page for this please let me know.