up:: Expo
react-native-push-notificationが先に出るが、標準でexpo-notificationsというのがあるのでそれを使えばいい。
ハンドラセットとパーミッション設定だけすれば、asyncで送れる。
Notifications.setNotificationHandler({
handleNotification: async () => ({
shouldShowAlert: true,
shouldPlaySound: false,
shouldSetBadge: false,
}),
});
const requestPermissionsAsync = async () => {
const { granted } = await Notifications.getPermissionsAsync();
if (granted) { return }
await Notifications.requestPermissionsAsync();
}
const scheduleNotificationAsync = async () => {
await Notifications.scheduleNotificationAsync({
content: {
body: 'test'
},
trigger: {
seconds: 3,
}
})
}