phonegap / phonegap-plugin-push

Register and receive push notifications
MIT License
1.94k stars 1.91k forks source link

PushNotification.hasPermission not working as expected #789

Closed simonpeters closed 8 years ago

simonpeters commented 8 years ago

Expected Behaviour

When running PushNotification.hasPermission I expect to get a boolean back if the user has already given permission or not.

Actual Behaviour

When running PushNotification.hasPermission and the user has not given permission yet, the permission modal popups. This not expected behaviour. I want to be able to ask for permissions later on the app when it makes more sense for the user.

Reproduce Scenario (including but not limited to)

Run PushNotification.hasPermission after deviceready. Before calling PushNotification.init

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

iOS 9.3.1

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

iPhone 6

Cordova CLI version and cordova platform version

Cordova CLI 6.1.0

Installed platforms: android 5.1.1 browser 4.1.0 ios 4.1.0

Plugin version

phonegap-plugin-push 1.6.1 "PushPlugin"

simonpeters commented 8 years ago

I found my mistake. I was also using the localNotifications plugin and was not aware the user needed to give permissions for this as well.

Closing issue, but leaving a comment so if someone else has this issue they hopefully find this post.

lock[bot] commented 6 years ago

This thread has been automatically locked.