EddyVerbruggen / Custom-URL-scheme

:link: Launch your Cordova/PhoneGap app by a Custom URL scheme like mycoolapp://
1.03k stars 365 forks source link

Uncaught ReferenceError: handleOpenURL is not defined (Android) #250

Closed erperejildo closed 6 years ago

erperejildo commented 6 years ago

I was following the README and also this video: https://www.youtube.com/watch?v=bWUVgkMS2so but I can't fix this error. I'm using angular-meteor and I have the function on this part of my code:

// deep linking
var handleOpenURL = function(url) {
    alert('receive URL '+url);
};

function onReady() {
    // hide status bar to display a 100% full screen
    if (window.StatusBar) window.StatusBar.hide();

    angular.bootstrap(document, [
        recipic
        ], {
            strictDi: true
        });
}

if (Meteor.isCordova) {
    angular.element(document).on('deviceready', onReady);
} else {
    angular.element(document).ready(onReady);
}

Am I forgetting something?

erperejildo commented 6 years ago

Fixed changing the function declaration:

handleOpenURL = function handleOpenURL(url) {
    alert('receive URL2 '+url);
};
cadesalaberry commented 6 years ago

I think this could have also worked:

window.handleOpenURL = function (url) {
  alert('receive URL2 ' + url);
};