When I start app by custom scheme url,event 'deviceready' trigger,and window.handleOpenURL in the getBillFromLink() execute;
then I open a webpage and resume the app from it,but window.handleOpenURL didn't execute;function onResume and getBillFromLink will execute;
but no matter how many times I resume the app from webpage after the first time, window.handleOpenURL will execute normally;
Here are code:
$ionicPlatform.on("deviceready", function () {
document.addEventListener("resume", onResume, false);
getBillFromLink().then(function (data) {
//todo
});
});
function onResume() {
getBillFromLink().then(function (data) {
//todo
});
}
function getBillFromLink() {
var deferred = $q.defer();
$timeout(function() {
window.handleOpenURL = function(url){
if(!!url){
deferred.resolve(url);
}else{
deferred.reject(url);
}
};
}, 0);
return deferred.promise;
}
how could I deal with the trouble?
thanks for your advice and sorry for my poor English:-)