0

我正在使用 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; });

问题是应用程序关闭时,但我在单击托盘应用程序打开时从托盘收到通知但

我没有在控制台(调试模式)或警报中获得有效负载数据。

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

4

1 回答 1

0
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;

}

于 2019-07-02T10:15:44.317 回答