일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- supabase storage public url not working
- 로컬 서버 접속
- Firebase authentication android apple login
- 소개팅앱 만들기 flutter
- Firebase authentication apple login 최신
- supabase edge function deploy error
- Stomp user connection event
- Android apple login 인증서 설정
- supabase storage feature not enabled for this tenant
- Firebase authentication android apple login setting
- 주 4일 근무제 log
- invite user for supabase project
- Firebase authentication apple login
- Android apple login
- 주 4일 근무제 경험담
- Spring google SMTP settings
- Android apple login identifier
- Stomp socket connection event
- Spring LocalDateTime response array
- Supabase edge function insert data
- no such module '__ObjC'
- 소개팅앱 만들기 stomp
- 소개팅앱 만들기
- Spring boot swagger blank screen
- stable-diffusion-webui local 접속
- DT_TOOLCHAIN_DIR cannot be used
- stable-diffusion-webui local 네트워크에서 접속
- Supabase edge function
- supabase edge function deploy error supabaseurl is required
- 주 4일 근무제
Archives
- Today
- Total
꿀맛코딩
Flutter awesome_notifications 앱 종료후 메시지 안보이는 현상 수정 방법 본문
Flutter 앱에서 fcm을 통해 message를 수신하고, 수신한 메시지를 awesome_notifications을 통해 보여주는 방식으로
코드를 짯는데 이상하게 Release build에서 앱을 종료후 fcm message를 수신하면 채팅 메시지가 보이지 않는 현상을 발견하였다.
위의 사진처럼 메시지는 보이지 않고 아이콘만 덩그러니 보인다.
그래서 혹시 서버측에서 notification title이나 message에 데이터가 들어가나 체크도 해보고,
chanel 설정이 잘못되었나 체크도 다 해봤는데,
알고보니 플러터가 업그레이드 되면서 릴리즈 빌드시 tree shaking 이 되면서 코드가 제거된다는 소리를 들었다.
이게 맞는 표현인지도 모르겠지만 아무튼 결론은
_onBackgroundMessage 함수에
@pragma('vm:entry-point') 어노테이션을 추가해서 삭제를 방지해주면 정상 동작한다.
FirebaseMessaging.onBackgroundMessage(_onBackgroundMessage);
@pragma('vm:entry-point')
Future<void> _onBackgroundMessage(RemoteMessage message) async {
final pushMessage = _remoteMessageToFcmMessage(message.data);
_pushReceiveStreamController.add(pushMessage);
LocalNotificationService.showChatFcmNotification(pushMessage);
}
반응형
'공부방 > Flutter' 카테고리의 다른 글
Comments