Push notification : Uncaught ReferenceError: PushNotification is not defined


Hello I am new to Ionic.
I want to use ionic push notification for android phone.

I followed all the instruction from [ionic website][1] and [this][2]

For the debugging, I typed ionic serve

And I saw

“Uncaught ReferenceError: PushNotification is not defined”

in Chrome console.

Of course, notification is not working.

What am I missing ?

Any comment would be very helpful.Thank you.

Below is What I have done

I have put below code in terminal

ionic add ionic-platform-web-client

ionic plugin add phonegap-plugin-push

ionic io init

My ionic config info

dev_push is false,

There is 'app_id'

There is 'api_key'

There is 'gcm_key'

v5.2.0 (I tried also v4.2.2)

Ionic cli

Below code is in $ionicPlatform.ready

var io = Ionic.io();

		var user = Ionic.User.current();
		if (!user.id) {
		  user.id = Ionic.User.anonymousId();
		// Just add some dummy data..
		user.set('name', 'moka');
		user.set('bio', 'This is my little bio');
	    var push = new Ionic.Push({
	      "onNotification": function(notification) {
	        alert('Received push notification!');
	      "pluginConfig": {
	        "android": {
	          "iconColor": "#0000FF"
	    var callback = function(data) {


// Edit

I changed form

ionic config set dev_push false


ionic config set dev_push true

It does not show no longer

“Uncaught ReferenceError: PushNotification is not defined”

However I am not sure if it’s correct way.
Because it was written on [this tutorial][2]

to turn off your development mode

ionic push --google-api-key your-google-api-key
ionic config set gcm_key your-gcm-project-number
ionic config set dev_push false

So it does not matter “Uncaught ReferenceError: PushNotification is not defined”, if I want to test on real android device ?
[1]: http://docs.ionic.io/docs/push-android-setup
[2]: https://devdactic.com/android-push-notifications/


Did you checked it by browser? If yes, You just check it by installing on device. Possibilites are there while running on browser for these kind of error.


In my case I was getting this error because I’ve used complete path of that git repo “ionic plugin add phonegap-plugin-push” rather than just a name like “phonegap-plugin-push”.

So try removing the complete path and you are good to go.

Hope this helps.