1 | initial version |
Here are the steps to create critical notifications in iOS using Expo SDK 42 managed:
expo install expo-notifications
.import { Notifications } from 'expo';
import * as Permissions from 'expo-permissions';
componentDidMount() {
this.registerForPushNotificationsAsync();
}
async registerForPushNotificationsAsync() {
const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);
if (status !== 'granted') {
alert('You need to allow push notifications to receive notifications.');
return;
}
const token = await Notifications.getExpoPushTokenAsync();
console.log(token);
}
await Notifications.presentCriticalNotificationAsync({
title: 'Critical Notification Title',
body: 'This is a critical notification body.',
ios: {
sound: true,
},
});
That's it! You have successfully created a critical notification in iOS using Expo SDK 42 managed.