Skip to content

Branch.io initSession returns empty BranchUniversalObject JSON and BranchLinkProperties JSON #184

Closed
@johnnypi6

Description

@johnnypi6

Hi, Many thanks for your ongoing support for the Unity community.

I'm trying to add a sharing feature to my existing app using Unity Branch SDK.
Branch SDK version 0.6.5.

I created the following deep links using the Unity Branch SDK.

https://xleague.app.link/r7DxT2wkZ5
https://xleague.app.link/4WPwY7jm05
https://xleague.app.link/LFfAOZuo05
https://xleague.app.link/hVR3fr0n05

And I retrieved BranchUniversalObject and BranchLinkProperties using the following code.

void Start()
{
    Branch.initSession(CallbackWithBranchUniversalObject);
}

void CallbackWithBranchUniversalObject(BranchUniversalObject buo, BranchLinkProperties linkProps, string error)
{
    if (error != null)
        Debug.Log($"Error : {error}");
    else
    {
        Debug.Log(buo.ToJsonString());
        Debug.Log(linkProps.ToJsonString());
        if (linkProps.controlParams.ContainsKey("$deviceID"))
        {
            string senderDeviceID = linkProps.controlParams["$deviceID"];
            ...
        }
    }
}

If I click the shared link on iPhone or Android, it will redirect me to Appstore or Google Play Store. I can install the app on the Appstore and Google Play Store.
But when I opened the app, initSession returns empty BranchUniversalObject JSON and BranchLinkProperties JSON.

BranchUniversalObject JSON
{
"$canonical_identifier": "",
"$canonical_url": "",
"$og_title": "",
"$og_description": "",
"$og_image_url": "",
"$publicly_indexable": "0",
"$locally_indexable": "0",
"$exp_date": "69425078400000",
"$keywords": [],
"metadata": "{}"
}

BranchLinkProperties JSON
{
"~tags": [],
"~feature": "",
"~alias": "",
"~channel": "",
"~stage": "",
"~duration": "0",
"control_params": {}
}

What makes me more confused is that initSession sometimes returns correct BranchUniversalObject JSON and BranchLinkProperties JSON as expected. I guess the Branch Short URL that I created only works for the first click.
I'd be much appreciated you if you could help me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions