How to check if device has activated push notifications?

How can I check if a device has activated push notifications ?

When users reach a certain view in my app, I’d like to check if their device has already accepted push notifications, and then, if no, show a sheet to pre-prompt them before running the “request push notification permission” action.

Is this possible ? I’m trying to achieve this :

For location services, there is the expression “has granted location permission”

How can we accomplish the same thing for notifications?

I’ve played around with expressions starting with “current user device’s” or “do a search for devices (current user = current user” but no success

@thibautranger i agree.
@nick.carroll is his suggestion possible?

The search for current user’s device count should be one way to do it. We have it on our radar to add other permissions checks like location services too though

1 Like

I’ve played around for the last few hours and have found limitations.

I’ve tried different expressions starting with “current user’s device” and then with the operator “push notification token” but with no success.

I ran a test while logged in into my app and I thought "current user's devices each item push notification count > 0 was working to know if push notifications were granted

But then, I uninstalled the app, installed it again, and logged back in. At this point, push notifications are not granted and no new device is created. But my previous devices (which were not deleted as I uninstalled the app) still contain a token, so my app thinks notifications are granted, when they are not.

Also, tons of users are going to use our apps without being logged in, and If a logged out user activates push notifications, it’s impossible to perform any check because the field “current user” field in the device datatype is blank.

I think an expression to check “current device has activated push notifications” is as much, (if not more!) important than the “has granted location permission” expression.

1 Like

agreed, an explicit call would be way better :slight_smile: on our board to address

3 Likes

We created a custom integration with expo-notifications and can confirm a similar issue, the push notification token is blank.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.