Hi,
I would like to use inoic push but I only manage to make it work on “ionic serve”.
I folowed documentation step by step :
$ ionic start myApp tabs
$ cd myApp
$ ionic add ionic-platform-web-client
$ ionic plugin add phonegap-plugin-push
$ ionic io init
$ ionic config set dev_push true
then I configured android :
$ ionic push --google-api-key your-google-api-key
$ ionic config set gcm_key <your-gcm-project-number>
And I tried :
->Without AngularJs :
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
Ionic.io();
var push = new Ionic.Push({});
push.register(function(token) {
// Log out your device token (Save this!)
console.log("Got Token:",token.token);
});
});
});
->With AngularJs :
.run(function($ionicPlatform, $ionicPush) {
$ionicPlatform.ready(function() {
$ionicPush.init({
"debug": true,
"onNotification": function(notification) {
var payload = notification.payload;
console.log(notification, payload);
},
"onRegister": function(data) {
console.log(data.token);
}
});
$ionicPush.register();
});
Both work with ionic serve and “ionic config set dev_push true”. But when I want to test on CordovaSim or on my android device nothing work, even with “ionic config set dev_push false”. It is like the register method were not called…
Has anyone managed to make ionic Push works on real device or CordovaSim ?