1

I am developing an Android app using Phonegap v7.1.1. To implement push notifications I am using phonegap-plugin-push v2.1.2. I followed all the steps mentioned in readme of the plugin.

However, while running phonegap build android in the command line, I am getting the following error:

Failed to install 'phonegap-plugin-push': Error: Variable(s) missing: SENDER_ID
at Object.mergeVariables (C:\Users\Anto Christopher\AppData\Roaming\npm\node_modules\phonegap\node_modules\cordova-lib\src\plugman\variable-merge.js:58:15)
at C:\Users\Anto Christopher\AppData\Roaming\npm\node_modules\phonegap\node_modules\cordova-lib\src\plugman\install.js:315:44
at _fulfilled (C:\Users\Anto Christopher\AppData\Roaming\npm\node_modules\phonegap\node_modules\q\q.js:787:54)
at self.promiseDispatch.done (C:\Users\Anto Christopher\AppData\Roaming\npm\node_modules\phonegap\node_modules\q\q.js:816:30)
at Promise.promise.promiseDispatch (C:\Users\Anto Christopher\AppData\Roaming\npm\node_modules\phonegap\node_modules\q\q.js:749:13)
at C:\Users\Anto Christopher\AppData\Roaming\npm\node_modules\phonegap\node_modules\q\q.js:557:44
at flush (C:\Users\Anto Christopher\AppData\Roaming\npm\node_modules\phonegap\node_modules\q\q.js:108:17)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)

Error: Variable(s) missing: SENDER_ID


google-services.json is in the root and I have added this part of code in config.xml.

<platform name="android">
    <resource-file src="google-services.json" target="google-services.json" />
    <allow-intent href="market:*" />
</platform>
<platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
</platform>
<preference name="android-build-tool" value="gradle" />
<plugin name="phonegap-plugin-push" spec="~1.8.4">
    <variable name="SENDER_ID" value="xxxxxxxxxxx" />
</plugin>

It would be really helpful if someone can point out where I am going wrong. Thank you.

  • did you pass your sender id ? – Hiten Dec 15 '17 at 13:18
  • As of version 2.0.0 the SENDER_ID parameter has been removed at install time. Instead you put your google-services.json (Android) and/or GoogleService-Info.plist in the root folder of your project and then add then add the resource file to your config.xml. This is what I have done. – anto-christo Dec 16 '17 at 05:33

0 Answers0