How it works...
The recipe we built here is a little contrived, but the core concepts needed to request permissions, register tokens, accept app data, and send push notifications in response to app data are all there.
In step 4, we defined the first part of the registerForPushNotificationsAsync function. We began by asking the user for their permission to send them notifications from our app via the Permissions.askAsync method, passing in the constant for the push notifications permission, Permissions.NOTIFICATIONS. We then saved the status property from the resolved return object, which will have the value 'granted' if the user granted permission. If we don't get permission, we return right away; otherwise, we get the token from Expo's ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access