我为Android https://github.com/firebase/quickstart-android/tree/master/messaging和ios https://github.com/firebase/quickstart-ios/tree/master/messaging配置并安装了示例Firebase快速入门应用。
我能够从Firebase控制台发送通知,但是当我打开通知时,我无法在Firebase控制台后端看到开放率。
根据文档,当用户点击通知时,会自动触发打开事件。
是否还有其他步骤可以查看从控制台发送的通知的开放率?
还有一种方法可以从API发送通知并仍然获得这些通知的开放费率吗?
答案 0 :(得分:0)
您需要在gradle中包含与firebase分析相关的依赖性。开放率是分析库的一部分。
检查您是否包含以下两项: 编译com.google.firebase:firebase-core:9.4.0' 编译com.google.firebase:firebase-messaging:9.4.0'
答案 1 :(得分:0)
如果您已在iOS 10上实现 UNUserNotificationCenterDelegate ,则需要致电
Messaging.messaging()。appDidReceiveMessage(userInfo)//将确认消息发送到Firebase Cloud Messging
在这两种委托方法中
public func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
let userInfo = notification.request.content.userInfo
Messaging.messaging().appDidReceiveMessage(userInfo)
}
public func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
let userInfo = response.notification.request.content.userInfo
Messaging.messaging().appDidReceiveMessage(userInfo)
completionHandler()
}
否则,您需要实现此UIApplicationDelegate方法:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
[[FIRMessaging messaging] appDidReceiveMessage:userInfo];
completionHandler(UIBackgroundFetchResultNoData);
}