Android onNotification从未在react-native-push-notification中调用 [英] Android onNotification never called in react-native-push-notification
本文介绍了Android onNotification从未在react-native-push-notification中调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
PushNotification.configure({
onNotification: function(notification) {
console.log( 'NOTIFICATION:', notification);
},
})
通知是从服务器中获得的来自服务器. 我把它放在 componentDidMount()和构造函数在App.js 中,但是从来没有调用过. 帮助.
notification received form the server when i clicked on it app is opened but onNotification never called. i put this in componentDidMount() and constructor in App.js but it's never called.. help..
推荐答案
您是否已将所需的代码添加到AndroidManifest.xml中?
Did you add the required code into the AndroidManifest.xml?
例如:
<!--more stuff above-->
<service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
来源: https://github.com/zo0r/react-native-push -通知
这篇关于Android onNotification从未在react-native-push-notification中调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文