Can i call android activity

Can i call android activity

Hi, i want to call android activity how can i do that ?

You can use jsb to call Android native codes. It can call static functions in java / kotlin. In your static functions, call the activity which you need.

Js call example:

    if (cc.sys.os === cc.sys.OS_ANDROID) {
        let className = "org/cocos2dx/javascript/AppActivity";
        let methodName = "showAlertDialog";
        let methodSignature = "(Ljava/lang/String;Ljava/lang/String;)V";
        jsb.reflection.callStaticMethod(className, methodName, methodSignature, "Title", "Native Call Test");
    else if (cc.sys.os === cc.sys.OS_IOS || cc.sys.os === cc.sys.OS_OSX) {
        jsb.reflection.callStaticMethod('AppController', 'showAlertDialog:withMessage:', "Title", "Native Call Test");

See the example project -> native-call for more information.
Hope this helps.