Why Push Notification on Ionic, won't work when i build with Ionic Package?

213 Views Asked by At

Push Notification is not working when i build the application when i use the command ionic package build android --profile Profile and when i use ionic build android it work for me, but Why? i need to work with ionic package not with ionic build

1

There are 1 best solutions below

1
On

This worked for me - see the bottom of this URL: https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PHONEGAP_BUILD.md

Users have reported issues with Ionic Cloud Build. Apparently there are some differences in the way variables are handled. If your app has an issue where the PushNotification object can't be found try the following.

Remove the inclusion of phonegap-plugin-push from config.xml. That is delete lines that look like this:

<plugin name="phonegap-plugin-push" spec="~1.9.1">
  <variable name="SENDER_ID" value="xxx"/>
</plugin>

Add the following lines into package.json in the cordovaPlugins array.

{
  "variables": {
    "SENDER_ID": "xxx"
  },
  "locator": "phonegap-plugin-push"
}