Ionic - Firebase | Phone Gap Push Notification Issue

Guys,

Im having this problem, Can some one provide a solution for this.

I have an app with basic push notifications with firebase

I have installed the phonegap plugin, and native aswell.
But in my code im getting this error under senderId

[ts]
Type ‘{ android: { senderID: string; }; ios: { alert: “true”; badge: true; sound: “false”; }; windows: …’ is not assignable to type ‘PushOptions’.
Types of property ‘android’ are incompatible.
Type ‘{ senderID: string; }’ is not assignable to type ‘AndroidPushOptions’.
Object literal may only specify known properties, and ‘senderID’ does not exist in type ‘AndroidPushOptions’.

Maybe change the D of ID to d in your code?

senderId

Just a shot in the dark

1 Like

still the error remains

keep getting the Same error !! can someone help please

1 Like

Hi I have the same error!
Maybe I can guess pushOption of ionic-native/push has been updated latelyScreenshot_6

Exactly the same error!

Any luck in getting it fixed?, I am also facing same thing today

Guys, I found whats the root cause for this. This is because of ionic Native plugin

npm install @ionic-native/push --save

I have reverted the folder with my previous native push. Then its working fine :slight_smile:

2 Likes

Thanks! I deleted the node_modules folder and changed @ionic-native/push dependency version to 4.1.0 in package.json file and it works now.

Yes, ionic-native/push has a breaking change https://github.com/ionic-team/ionic-native/compare/v4.2.1...v4.3.0, so downgraded it to 4.1.0 for the time being

1 Like

hello
I deleted the node_modules folder and changed @ionic-native/push dependency version to 4.1.0 in package.json and when i run ionic serve iget this erreur !
ionic serve
Error: Cannot find module '@angular/tsc-wrapped/src/tsc’
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object. (C:\favourite-web-technologies\node_modules@ionic\app -scripts\dist\aot\aot-compiler.js:7:13)
at Module._compile (module.js:569:30)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)

irun npm i @angular/tsc-wrapped then the same error appear !

Type ‘{ android: { senderID: string; }; windows: {}; }’ is not assignable to type ‘PushOptions’. Types of property ‘android’ are incompatible. Type ‘{ senderID: string; }’ is not assignable to type ‘AndroidPushOptions’. Object literal may only specify known properties, and ‘senderID’ does not exist in type ‘AndroidPushOptions’.

!!!

I think u dont need to delete entire nodemodules folder. Also you have to install the older version of nativepush4.1.0

someone worked, could I provide the code of app.componet.ts ?? I still can not solve it I have an errorr in: Error: Uncaught (in promise): TypeError: Can not read property ‘initPushNotification’ of undefined
TypeError: Can not read property ‘initPushNotification’ of undefined

Latest push plugin has problem.
Use this “@ionic-native/push”: “4.0.1”, plugin

Don’t upgrade @ionic-native/push to 4.3.

@ionic-native/push": "^4.2.1"

phonegap-plugin-push@1.10.5 shall be used, because @2.0.0 is actualy broken

1 Like

Worked with @ionic-native/push:4.2.1 and phonegap-plugin-push@1.10.5

2 Likes

I’m just reformating the above answer which worked for me.

  • First, uninstall the PhoneGap-push plugin 2.0

  • Then go to project -> package.json and search for push and replace the line with “”: “4.0.1” earlier it will be 4.3.0 or 4.3.1

  • Now add push plugin again to the project with below command ionic plugin add phonegap-plugin-push@1.10.5 --variable SENDER_ID=XXXXXXX

  • Now build your app works like a charm…

1 Like

Also be careful that sender id should be string with not number format.