havesource / cordova-plugin-push

Register and receive push notifications
MIT License
149 stars 284 forks source link

Android PushNotification Is undefined #267

Open Kklung011 opened 7 months ago

Kklung011 commented 7 months ago

I have a Cordova project

This is my code:

try{ alert(window.PushNotification) var push = window.PushNotification.init({ android: { senderID: this.$appInfo.NotificationSenderID, }, ios: { alert: "true", badge: "true", sound: "true", clearBadge: true, }, windows: {}, }); }catch(e){ alert(e) }

This code in iOS is working but not working in android It will alert ‘undefined ’

I try anyway as I can search but didn’t find solution Can any give any solution can fixed it

erisu commented 1 week ago

I was unable to reproduce this issue.

Please try uninstalling and reinstalling the plugin to the latest version. Monitor the console output during installation for any errors, and consider using the --verbose flag for more detailed information.

Ensure that you are using the latest version of the Cordova-Android platform. At least 12.0.0 or higher. Older versions will prevent the plugin from installing.

Also confirm that you are waiting for the deviceready event to fire before invoking any of the plugin's APIs.