我正在使用FirebaseInAppMessaging并且可以正常工作。然后我使用注册操作回调FirebaseInAppMessagingClickListener,它没有调用。
public class InAppMessageClick implements FirebaseInAppMessagingClickListener, FirebaseInAppMessagingImpressionListener, FirebaseInAppMessagingDisplay {
String TAG = "InAppMessageClick";
@Override
public void messageClicked(InAppMessage inAppMessage, Action action) {
// Determine which URL the user clicked
String url = action.getActionUrl();
LogUtils.i(TAG, "Action URL : "+url);
// Get general information about the campaign
CampaignMetadata metadata = inAppMessage.getCampaignMetadata();
Log.i(TAG," Metadata : "+metadata);
}
@Override
public void impressionDetected(InAppMessage inAppMessage) {
LogUtils.i(TAG, "impressionDetected Action URL : "+inAppMessage.getCampaignMetadata().getCampaignName());
}
@Override
public void displayMessage(InAppMessage inAppMessage, FirebaseInAppMessagingDisplayCallbacks firebaseInAppMessagingDisplayCallbacks) {
LogUtils.i(TAG, "displayMessage Action URL : "+inAppMessage.getCampaignMetadata().getCampaignName());
}
}
我在 MainActivity 的 onCreate 中注册了这个点击监听器
InAppMessageClick inAppMessageClick = new InAppMessageClick();
FirebaseInAppMessaging.getInstance().setMessageDisplayComponent(inAppMessageClick);
FirebaseInAppMessaging.getInstance().addClickListener(inAppMessageClick);
我尝试通过两种方式注册监听器。
InAppMessageClick inAppMessageClick = new InAppMessageClick();
FirebaseInAppMessaging.getInstance().addClickListener(inAppMessageClick);`
或者
FirebaseInAppMessaging.getInstance().addClickListener(inAppMessageClick, new Executor() {
@Override
public void execute(Runnable command) {
LogUtils.i("MainActivity", "FIAM CLICKED EXECUTOR");
}
});
`
并使用gradle
implementation 'com.google.firebase:firebase-inappmessaging-display:18.0.2'
implementation 'com.google.firebase:firebase-core:17.0.1'
慕哥9229398
大话西游666
跃然一笑
江户川乱折腾
相关分类