在我们的应用程序中,用户会收到各种通知。 而且,我们还有“通知”权限屏幕,可以在其中切换特定通知类型“新闻”,“朋友请求”等的权限。
对于前台通知,我们可以检查特定字段的通知数据,然后根据当前设置显示或不显示通知。
我们如何针对后台通知进行处理?可能吗?
答案 0 :(得分:0)
https://console.firebase.google.com/u/0/project/customizedimgaepickerproject/notification
Setting.gradle
include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir,
'../node_modules/react-native-firebase/android')
react-native链接react-native-firebase
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<service android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="io.invertase.firebase.messaging.RNFirebaseBackgroundMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
build.gradle --app
implementation project(':react-native-firebase')
implementation "com.google.android.gms:play-services-base:16.1.0"
implementation "com.google.firebase:firebase-core:17.0.1"
implementation "com.google.firebase:firebase-messaging:19.0.1"
implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
compile(project(':react-native-firebase')) {
transitive = false
}
apply plugin: 'com.google.gms.google-services' //in bottom build.gradle app level
MainAppliaction
import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;
packages.add(new RNFirebaseMessagingPackage());
packages.add(new RNFirebaseNotificationsPackage());