反应本地博览会推送通知

时间:2020-02-16 13:32:01

标签: android firebase react-native push-notification expo

我只是从React Native开始,还不完全了解以下内容。

我正在使用Expo,Android和Firebase(免费版)。我想设置推送通知,并在网上关注了一个教程,因此可以正常工作!

教程:https://www.youtube.com/watch?v=-2zoM_QWGY0

在本教程中,作者使用以下方法从Expo文档发送推送通知;

enter image description here

我想澄清的是-如果应用程序安装在设备上即无法通过Android设备上的Expo应用程序运行,这是否不正确?

例如,当用户从Google PlayStore下载APK / app时,这是否会在现实生活中起作用?

很抱歉这个简单的问题,但似乎找不到能具体回答这个问题的东西。

在我的代码中发送通知功能;

sendPushNotification = () => {
let response = fetch('https://exp.host/--/api/v2/push/send', {
  method: 'POST',
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify( {
    to: 'I have the device token here',
    sound: 'default',
    title: 'Demo',
    body: 'Demo Notification'
  })
})

};

0 个答案:

没有答案