博览会通知中的 DailyNotificationTrigger 在 Android 设备上不起作用
DailyNotificationTrigger in expo-notifications not working on Android device
我正在尝试使用 expo-notifications 在 Expo 应用程序中实现通知。我在 scheduleNotificationAsync
中的触发器对象符合 DailyNotificationTrigger
接口,但我仍然收到此错误:
[Unhandled promise rejection: Error: Failed to schedule the notification. Trigger of type: calendar is not supported on Android.]
这是产生错误的代码片段:
Notifications.scheduleNotificationAsync({
content: {
title: 'Complete a quiz',
body: " Don't forget solve a quiz today!",
},
trigger: {
type: 'daily',
hour: 8,
minute: 0,
},
})
我的目标设备是 Android 10 上的模拟器 运行。请帮助我确定并解决问题。
通知在模拟器上不起作用。您必须 运行 它在您的物理设备上才能使通知正常工作
从界面 DailyTriggerInput
得到了我的提示。工作代码应如下所示:
Notifications.scheduleNotificationAsync({
content: {
title: 'Winter is coming!'
},
trigger: {
hour: 18, minute: 36, repeats: true
}
})
我正在尝试使用 expo-notifications 在 Expo 应用程序中实现通知。我在 scheduleNotificationAsync
中的触发器对象符合 DailyNotificationTrigger
接口,但我仍然收到此错误:
[Unhandled promise rejection: Error: Failed to schedule the notification. Trigger of type: calendar is not supported on Android.]
这是产生错误的代码片段:
Notifications.scheduleNotificationAsync({
content: {
title: 'Complete a quiz',
body: " Don't forget solve a quiz today!",
},
trigger: {
type: 'daily',
hour: 8,
minute: 0,
},
})
我的目标设备是 Android 10 上的模拟器 运行。请帮助我确定并解决问题。
通知在模拟器上不起作用。您必须 运行 它在您的物理设备上才能使通知正常工作
从界面 DailyTriggerInput
得到了我的提示。工作代码应如下所示:
Notifications.scheduleNotificationAsync({
content: {
title: 'Winter is coming!'
},
trigger: {
hour: 18, minute: 36, repeats: true
}
})