Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch not ready on deviceready event #16

Closed
rphansen91 opened this issue Oct 2, 2015 · 5 comments
Closed

Branch not ready on deviceready event #16

rphansen91 opened this issue Oct 2, 2015 · 5 comments
Assignees

Comments

@rphansen91
Copy link

After a lot of struggles with the SDK and seemingly random responses / no response from the branch.init() method I integrated Weiner in order to view the network requests and Local Storage of the device.

Sometimes when logging the branch object the values are populated and methods are in place. However much of the time the branch object logs empty with solely the proto property and the init function is undefined.

As I am using branch asynchronously this blocks the load of my app as other components depend on this data. How can I ensure that branch is ready everytime the user opens the app?

@rphansen91
Copy link
Author

Here is the gist of the branch initialization code

var nativeAppTypeProvider = {}
nativeAppTypeProvider.AndroidDeviceReady = function () {        
    if (branch && typeof branch.init == "function") {
        branch.init(ENVIRONMENT.branchKey, function(err, data) {
            alert(JSON.stringify(data))
            alert(JSON.stringify(err))
            branch.first(function (firstErr, firstData) {
                alert(JSON.stringify(firstErr))
                alert(JSON.stringify(firstData))
                branch.close()
            })
        })
    } else {
        alert("Branch not initialized")
    }
}

document.addEventListener('deviceready', nativeAppTypeProvider.AndroidDeviceReady, false)

On the first open/load of the app branch initializes and the init and first callbacks fire successfully, however on subsequent attempts after a hard close of the app branch is typeof Object however branch.init is undefined within the scope of the nativeAppTypeProvider.AndroidDeviceReady function after the deviceready event

@requested
Copy link

Any progress with this? I'm experiencing the same issue right now.

@aaustin
Copy link
Contributor

aaustin commented Oct 27, 2015

We're about to dig in and spend substantial time upgrading this repo. Give us a couple days.

@jsaleigh jsaleigh self-assigned this Oct 28, 2015
@jsaleigh
Copy link
Contributor

jsaleigh commented Nov 2, 2015

Hi @rphansen91, we recently made a change which may help with the issue you're seeing, both on the master branch and tagged with v1.7.1

If you are still seeing the issue with this new build, please let me know.

@aaustin
Copy link
Contributor

aaustin commented Dec 22, 2015

Closing since it was addressed in earlier version

@aaustin aaustin closed this as completed Dec 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants