gpt4 book ai didi

java - 在Android推送通知中,当应用程序关闭时,我们如何获取点击托盘时的有效负载数据?

转载 作者:行者123 更新时间:2023-12-02 03:54:19 25 4
gpt4 key购买 nike

我正在使用 React Native Flurry SDK (react-native-flurry-sdk)

Flurry push React-native

Flurry push Android Native工作正常

// Optionally add a listener to receive messaging events, and handle the notification.
// Please call required Flurry.willHandleMessage(boolean) when received event types of
// MessageType.RECEIVED or MessageType.CLICKED as soon as possible to avoid delay.
Flurry.addMessagingListener((message) => {
if (message.Type === Flurry.MessageType.RECEIVED) {
Flurry.willHandleMessage(false);
} else if (message.Type === Flurry.MessageType.CLICKED) {
Flurry.willHandleMessage(false);
}

Flurry.printMessage(message);
});

// Message.Type: Flurry.MessageType = { RECEIVED, CLICKED,
// CANCELLED, REFRESH } (Android only)
// Message.Title: message title
// Message.Body: message body
// Message.Data: message data (Map)
// Message.ClickAction: click action (Android only)
// Message.Token: refreshed token
Flurry.addMessagingListener(callback: (message: { Type: string;
Title?: string; Body?: string; Data?: { [key: string]: string; }; ClickAction?: string;
Token?: string; }) => void);
Flurry.removeMessagingListener(callback: (message: { Type: string;
Title?: string; Body?: string; Data?: { [key: string]: string; }; ClickAction?: string;
Token?: string; }) => void);
Flurry.willHandleMessage(handled: boolean);
Flurry.printMessage(message: { Type: string;
Title?: string; Body?: string; Data?: { [key: string]: string; }; ClickAction?: string;
Token?: string; });

问题是当应用程序关闭时,但当我单击托盘应用程序已打开时,我收到了来自托盘的通知,但是

i didn't get payload data in console(debug mode) or alert.

你能给我一个逻辑解决方案或任何文档吗?

最佳答案

public boolean onNotificationClicked(final FlurryMessage flurryMessage) {
sEnableMessagingListener = true;
new android.os.Handler().postDelayed(
new Runnable() {
public void run() {
Log.i("tag", "This'll run 300 milliseconds later");
Log.d("Click0012","ff11"+ "ggg"+ sReactApplicationContext + "ddd" + flurryMessage);

Log.d("message001","ff"+flag +"999"+ sReactApplicationContext+"ff"+ sEnableMessagingListener);
if (sEnableMessagingListener && (sReactApplicationContext != null)) {
Log.d("Clicked002","ff"+flurryMessage);
sendEvent(EventType.NotificationClicked, flurryMessage, true);
}
}
},
900);



return false;

}

关于java - 在Android推送通知中,当应用程序关闭时,我们如何获取点击托盘时的有效负载数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56759501/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com