Push full setup

I am a noob to ionic and following the push service tutorial at http://docs.ionic.io/v2.0.0-beta/docs/push-full-setup.

When I change the dev_push to false using the following command:

ionic config set dev_push false

I stop seeing the device token in the iOS debug screen.

when I have dev_push set to true, I am able to see the Device token. I appreciate any guidance.

I have the following code in ready function:

console.log(“creating push notification object”);

var push = new Ionic.Push({
“debug”: false
});

console.log(“registering for push notification”);

push.register(function(token) {
console.log(“Device token:”,token.token);
push.saveToken(token); // persist the token in the Ionic Platform
});

Output when dev_push is set to false:
2016-03-22 21:31:19.080 pocApp[856:237886] creating push notification object
2016-03-22 21:31:19.080 pocApp[856:237886] registering for push notification
2016-03-22 21:31:19.080 pocApp[856:237886] Ionic Push: register
2016-03-22 21:31:19.501 pocApp[856:237886] Ionic Push (dev): registered with development push service
2016-03-22 21:31:19.502 pocApp[856:237886] Device token: DEV-7a67b499-b32e-473b-bc3b-dac31aacec63
2016-03-22 21:31:19.502 pocApp[856:237886] Ionic Push (dev): watching for new notifications

Output when dev_push set to true
2016-03-22 21:35:46.620 pocApp[863:239014] [CDVTimer][TotalPluginStartup] 161.939025ms
2016-03-22 21:35:46.629 pocApp[863:239014] active
2016-03-22 21:35:46.750 pocApp[863:239014] Resetting plugins due to page load.
2016-03-22 21:35:47.610 pocApp[863:239014] Finished load of: file:///var/containers/Bundle/Application/D4A31B42-7E4C-4343-B282-69DCB435C3A6/pocApp.app/www/index.html#/app/playlists

Hi @vivsriva,

dev_push true allows you to use Ionic’s limited push functionality. This ‘limited setup’ will allow you to test push code without setting up APNS or GCM (Apple and Google push notification services, respectively). Once you set dev_push to true, then you need to have enabled APNS or GCM for the device token to be generated.

Have you set up APNS or GCM? If not, I would start there.

Thanks @stewartmccoy. Appreciate your comment. I did get it to work. There are several versions of push libraries and once I uninstalled and reinstalled the solution worked and I can see the device token.

1 Like

Hi vivsriva,
Did you create a package file with Ionic Package service? My app registers with GCM and push notifications alerts.
But when I install the .apk file on an android phone, it does not register. I use visual studio on windows. Ionic 1.x and WordPress push notifications plugin.