Create deep links to iOS / Android app


I want to be able to create deep links to my app, via a URL scheme, such as


– what would be the strategy to implement this in Cocos Creator (i.e. how can I retrieve the parameters given to the URL scheme once the app has been opened?)?

Thanks :slight_smile:

Hello! Are there any ideas on how to achieve this?

What is your cocos creator version? I think the documents you provide is very clear about application access, not sure what your confusion is?

In version 2.4, you need to add your function code to the source code below



if you need pass params to JavaScript, you can use this function( called after engine initialize finish).


android :

1 Like

Thanks, that sounds good! :slight_smile:

One question:

Once I have my code in ,

how do I set a global variable in my Game?

(Say, if I wanted to set “window.myvariable”, which should be available from my game’s main JS script.)

Thank you!

I’m trying to implement the iOS deep links.

My first question: When I add

continueUserActivity:(NSUserActivity *)userActivity

to my main method:

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {[[SDKWrapper getInstance] application:application didFinishLaunchingWithOptions:launchOptions];

… the app crashes. What am I doing wrong?

(I took this as a template for making userActivity available here, as I needed to find an Objective-C (and not Swift) example: iOS Tutorial => Setup iOS Application (Enabling Universal Links))

My second question: my plan would then be to use this code to examine the URL used:

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler   didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [[SDKWrapper getInstance] application:application  didFinishLaunchingWithOptions:launchOptions] ;
    // Add the view controller's view to the window and display.
    float scale = [[UIScreen mainScreen] scale];
    CGRect bounds = [[UIScreen mainScreen] bounds];
    window = [[UIWindow alloc] initWithFrame: bounds];


    ///Checking whether the activity was from a web page redirect to the app.
        if ([userActivity.activityType isEqualToString: NSUserActivityTypeBrowsingWeb]) {
            ///Getting the URL from the UserActivty Object.
            NSURL *url = userActivity.webpageURL;
            NSLog(@"Value of string is %@", url);
            if ([url.pathComponents containsObject:@"start"]) {
                NSLog(@"Contains start.");

– is that the right approach?

My third question: How do I then get the data from the URL (once I extracted it) to my game’s main JS?

As always, thank you very much!

All the best,

I’ll ask engineering to help.

Thank you, looking forward!

I believe @huanxinyin is already aware of this question

Thanks for looking into this.

I will make sure this is looked into when the engineering team returns from national holiday.

You need to include the header file, and then call the corresponding function, you can refer to the following source code.


for example:

se::ScriptEngine::getInstance()->evalString("window.your_func('put string here')");