Hello.
I want to add push notifications to my app, but I have an issue.
I tried to implement example from docs:
async function registerForPushNotificationsAsync() {
// Android remote notification permissions are granted during the app
// install, so this will only ask on iOS
let { status } = await Permissions.askAsync(Permissions.REMOTE_NOTIFICATIONS);
// Stop here if the user did not grant permissions
if (status !== 'granted') {
return;
}
// Get the token that uniquely identifies this device
let token = await Notifications.getExponentPushTokenAsync();
// POST the token to our backend so we can use it to send pushes from there
return fetch(PUSH_ENDPOINT, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
token: {
value: token,
},
user: {
username: 'Brent',
},
}),
});
}
But the function doesn’t continue after this line:
let token = await Notifications.getExponentPushTokenAsync();
No output, no errors. Android. SDK 15.0.0