从上图可以看到,即使我非常确定至少有1%的人会打开推送通知,所有推送通知始终显示零打开率。
我想跟踪一天中每条已发送邮件的打开率。
但是,如果从Firebase控制台基于当天打开总体报告,它将跟踪一天中发送的所有邮件的打开率,如下图所示:
那么为什么每张发送的邮件的打开率总是如零所示?
在Android中,我使用此gradle:
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-ads:17.1.3'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.google.firebase:firebase-messaging:17.4.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.8@aar') {
transitive = true;
}
我的消息服务类:
public class MyFirebaseMessagingService extends FirebaseMessagingService {
//*********** Called when the Notification is Received ********//
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Bitmap notificationBitmap = null;
String notification_title, notification_message, notification_image = "";
if (remoteMessage.getData().size() > 0) {
notification_title = remoteMessage.getData().get("title");
notification_message = remoteMessage.getData().get("message");
notification_image = remoteMessage.getData().get("image");
} else {
notification_title = remoteMessage.getNotification().getTitle();
notification_message = remoteMessage.getNotification().getBody();
}
notificationBitmap = getBitmapFromUrl(notification_image);
Intent notificationIntent = new Intent(getApplicationContext(), MainActivity.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
NotificationHelper.showNewNotification
(
getApplicationContext(),
notificationIntent,
notification_title,
notification_message,
notificationBitmap
);
}
public Bitmap getBitmapFromUrl(String imageUrl) {
if ("".equalsIgnoreCase(imageUrl)) {
return null;
}
else {
try {
URL url = new URL(imageUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
return BitmapFactory.decodeStream(input);
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}
}
这里出了什么问题?