diff --git a/src/android/io/branch/BranchSDK.java b/src/android/io/branch/BranchSDK.java index 9f4d5135..429533bd 100644 --- a/src/android/io/branch/BranchSDK.java +++ b/src/android/io/branch/BranchSDK.java @@ -773,9 +773,7 @@ public void onInitFinished(JSONObject referringParams, BranchError error) { Log.d(LCAT, "SessionListener onInitFinished()"); - String out = String.format("DeepLinkHandler(%s)", referringParams.toString()); - - webView.sendJavascript(out); + String out = ""; if (this._callbackContext == null) { return; @@ -783,6 +781,8 @@ public void onInitFinished(JSONObject referringParams, BranchError error) { if (error == null) { + out = String.format("DeepLinkHandler(%s)", referringParams.toString()); + // params are the deep linked params associated with the link that the user clicked -> was re-directed to this app // params will be empty if no data found. if (referringParams == null) { @@ -798,11 +798,15 @@ public void onInitFinished(JSONObject referringParams, BranchError error) { } else { String errorMessage = error.getMessage(); + out = String.format("NonBranchLinkHandler(%s)", error.toString()); + Log.d(LCAT, errorMessage); this._callbackContext.error(errorMessage); } + webView.sendJavascript(out); + } } diff --git a/testbed/www/js/index.js b/testbed/www/js/index.js index ab21e567..ee3feb4f 100644 --- a/testbed/www/js/index.js +++ b/testbed/www/js/index.js @@ -69,6 +69,13 @@ function NonBranchLinkHandler(data) } } +function NonBranchLinkHandler(data) +{ + if (data) { + alert('Non-branch link found: ' + JSON.stringify(data)); + } +} + function SetDebug(isEnabled) { console.log('Trigger SetDebug()');