.run(function($ionicPlatform, $http,config) {
$ionicPlatform.ready(function() {
var device_token = localStorage.getItem('device_token'); if(!device_token){
var push = new Ionic.Push({ "debug": true });
push.register(function(obj) { push.saveToken(obj); localStorage.setItem('device_token',obj.token); });
}
});
})
Above code is working fine. But how do I register the token other controllers? means no within the run() of ionic? In my case I would like not to register the token when the app launch, but when user interact with some part of the app.