Kew*_*hah 5 notifications react-native expo
我正在尝试使用 expo-notifications 在 Expo 应用程序中实现通知。我的触发器对象scheduleNotificationAsync符合DailyNotificationTrigger接口,但我仍然收到此错误:
[Unhandled promise rejection: Error: Failed to schedule the notification. Trigger of type: calendar is not supported on Android.]
Run Code Online (Sandbox Code Playgroud)
这是产生错误的代码片段:
Notifications.scheduleNotificationAsync({
content: {
title: 'Complete a quiz',
body: " Don't forget solve a quiz today!",
},
trigger: {
type: 'daily',
hour: 8,
minute: 0,
},
})
Run Code Online (Sandbox Code Playgroud)
我的目标设备是在 Android 10 上运行的模拟器。请帮助我识别并解决问题。
小智 8
从界面得到我的提示DailyTriggerInput。工作代码应如下所示:
Notifications.scheduleNotificationAsync({
content: {
title: 'Winter is coming!'
},
trigger: {
hour: 18, minute: 36, repeats: true
}
})
Run Code Online (Sandbox Code Playgroud)