gpt4 book ai didi

android - 如何使用 react-native-push-notification 创建本地推送通知

转载 作者:搜寻专家 更新时间:2023-11-01 09:36:12 25 4
gpt4 key购买 nike

我正在使用 react-native 开发一个 android 应用程序,我想为此使用本地推送通知,就像每当我点击按钮时,应该创建推送通知。我怎样才能做到这一点?有人请给我一些建议。

最佳答案

你可以用 react-native-push-notification 试试这个

import PushNotification from 'react-native-push-notification';

scheduleNotfication() {
PushNotification.localNotificationSchedule({
message: "My Notification Message", // message
date: new Date(Date.now() + (60 * 1000)) // your required time
});
}

按钮

<Button title="title of button" onPress ={this.scheduleNotfication() } > 
<Text>show</Text>
</Button>

关于android - 如何使用 react-native-push-notification 创建本地推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43041667/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com