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,但是当应用程序关闭时,将根本不执行句柄功能吗? 有人可以帮忙吗?
答案 0 :(得分:2)
通过在app.json文件中添加此文件来解决
{
"expo": {
"userInterfaceStyle": "automatic",
"ios": {
"userInterfaceStyle": "light"
},
"android": {
"userInterfaceStyle": "dark"
}
}
}