receivedNotificationHandler method

Future<void> receivedNotificationHandler(
  1. ReceivedNotificationHandler handler
)

Implementation

Future<void> receivedNotificationHandler(ReceivedNotificationHandler handler) async {
  _onReceivedNotificationHandler = handler;

  //앱 미실행 중(완벽히 종료된 상태)  푸시를 터치하고 앱을 실행하는 경우
  //iOS는 AppDelegate에서 푸시메세지를 NSUserDefault에 저장하고 푸시읽음 handler를 셋팅하는데 걸리는 시간 차가 1초면 되지만
  //Android는 기기에 따라 3초까지도 지연이 발생한다. AOS기준 3초로 셋팅.
  // _sendLog("푸시 읽음!");

  Future.delayed(const Duration(seconds: 3), () async {
    String? mesg = await _getPushMessage();
    if (mesg != null) {

      //푸시 읽음 처리
      confirmPushRead(mesg);
      NtiuspPayload pObj = await getPayloadObject(mesg);
      _onReceivedNotificationHandler!(pObj);
      _removePushMessage();
      FlutterAppBadger.removeBadge();

    }
  });
}