스마트시대

PUSH NOTIFICATIONS 29.1 getToken 29.2 Foreground Notifications 29.3 Background Notification 29.4 ShellRoute 29.5 Targeted Notification 본문

Programing/Flutter

PUSH NOTIFICATIONS 29.1 getToken 29.2 Foreground Notifications 29.3 Background Notification 29.4 ShellRoute 29.5 Targeted Notification

스마트시대 2023. 6. 7. 01:26
728x90

flutter pub add firebase_messaging
flutterfire configure

 

29.1 getToken

여기서 토큰 생긴거 확인하고 토큰 복사해 밑에 붙여넣기

 

29.2 Foreground Notifications

 

29.3 Background Notification

 

백그라운드에 있던 앱의 노티를 클릭하면 이런식으로 프린트 된다.

이걸로 유저가 chatroom으로 가는데 정확이 어느 룸으로 유저를 보낼지도 정할 수 있다.

 

 

29.4 ShellRoute 

진짜 route를 감싸는 일종의 wrapper

이걸로 다른 모든 라우트를 감싸서 알림 provider를 초기화 할 수 있음

깃헙 참조

 

이 코드로 background에서 알림 눌렀을 때는 ChatsScreen으로

kill했다가 알림 눌렀을 때는 VideoRecordingScreen으로 가는걸 확인할 수 있다.

 

29.5 Targeted Notification

유저 uid복사해서

 

모든 비디오 creatorUid에 붙여넣기(안드로이드에 알람 보내기 위한 작은 트릭)

 

//sendToDevice is deprecated. 대신 send사용하자

 

firebase deploy --only functions

 

728x90
반응형
Comments