-
Notifications
You must be signed in to change notification settings - Fork 1.9k
check whether Push Notification Permissions have been enabled for this app #305
Conversation
@zwacky did a quick look and it seems fine. Can you add some explanation in the README file? |
yes i will do it tomorrow. sorry wasn't available last days. |
@macdonst hope it's alright |
Making a note here so that we remember to take a new look at this with the new permission stuff from android-5.0, things might be easier with it. |
@macdonst in reference to #326, this was the patch that I put in, that seemed to disrupt the notification handling, when used perhaps inappropriately. I traced it down to the fact that in this patch, Given this, with regards to this patch, it might be wise to either 1) handle the |
@stinju i see what you mean. i definitely would expect it to be used after so instead of using the gotta test things first before this will be merged. |
@zwacky yeah, use the new callbackContext for that method call. The sendEvent method is a convenience method for all of the remote notifications that come in. |
also found out, the the android minSDK = 19 (android 4.4) since it uses |
What is blocking this PR to be merged ? |
this should fix the last issue @stinju mentioned. |
@zwacky In your example you call |
it's just an additional function, it that has nothing to do with it's just to prevent the user from having a push notification permission request popup at startup, that most probably will be declined. you can then call with |
Thanks for the feedback. But my question was more focused on the fact that |
yep, polling the permission. that's how i track it though. |
Good to know, thanks for the clarification. |
@zwacky Do you have any time to resolve the merge conflicts on this PR? |
maybe i'm blind... where can i see the conflicts? |
@zwacky Oh right, you don't see the Merge box because you don't have committer access. Leave it with me. |
@zwacky I have a problem with the example:
If I'm starting up a brand new app on iOS then |
@zwacky actually it is the same thing on Android as well. The permission check works great but we may want to change the example docs. |
Merged into v1.5.x branch |
yeah you're right. should have a hint, that you need to check for that will update the docs. |
@zwacky if you update the docs please do so in the v1.5.x branch which is the current dev branch. |
i did: #425 |
I'm closing this PR as it has been merged into v1.5.x and will become part of master soon. |
So, call init() first and then poll for a response using hasPermission() But, hasPermission() returns false the first time the app is open since push has never been granted, so polling using this function will return false while X seconds later, the user may allow push notifications and then hasPermission() will return true. But, it seems that the .on("registration") event ALWAYS fires even when the push is not allowed. The difference being that the provided data.registrationId is empty if the user didn't allow push and populated if push was allowed. |
@JeremyColton there isn't a nice and sophisticated way than trying, because we don't have hooks for the native permission request modal. i ask the user, if he'd like to stay up to date. then if he does, i |
@JeremyColton , so do you have any solution to solve that issue? |
This thread has been automatically locked. |
as soon as you run
var push = window.PushNotification.init({ ...
the app will ask the user for push notification permission. with this you have more flexibility.example usage:
it will always return a json in format: