关闭应用程序时处理博览会推送通知 [英] handling expo push notifications when app is closed

查看:63
本文介绍了关闭应用程序时处理博览会推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

sdk 37博览会

componentDidMount() {
this.registerForPushNotificationsAsync();
this._notificationSubscription = Notifications.addListener(this._handleNotification);
}
_handleNotification = notification => {
Vibration.vibrate();
console.log(notification);
console.log("hello")
this.setState({ notification: notification });
};

将应用程序置于前台时,将执行句柄功能并执行console.log,但是当应用程序关闭时,将根本不执行句柄功能吗?有人可以帮忙吗?

When the app is foregrounded the handle function is executed and the console.log is executed but when the app is closed the handle function is not executed at all? Can anyone help?

推荐答案

通过将其添加到app.json文件中解决了该问题

Solved it by adding this in app.json file

{
  "expo": {
    "userInterfaceStyle": "automatic",
    "ios": {
      "userInterfaceStyle": "light"
    },
    "android": {
      "userInterfaceStyle": "dark"
    }
  }
}

这篇关于关闭应用程序时处理博览会推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆