inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

배달앱 클론코딩 [with React Native]

푸쉬 메시지 오는 것 확인!

remote push notification이 포그라운드에서 팝업되지 않아요

해결된 질문

1124

Oim

작성한 질문수 4

0

핸드폰 상단바에서 알림 표시만 되고 알림 팝업은 되지 않습니다.

localNotification을 활용해서 팝업시켜 봤지만 그렇게 될 경우 onNotification과 함께 중복된 알람 2개가 동시에 옵니다.그리고 상단바를 열어서 localNotification으로 온 알람을 press하게 되면 데이터가 빈 오브젝트로 넘어와서 Screen Navigate를 하지 못합니다.

(onNotification로 발생하는 알림에서만 데이터를 활용할 수 있는 상황입니다)

결론은 onNotification로 온 알림이 팝업되어서 press를 하면 해당 화면을 이동시키는게 최종 목적이고

현재 포그라운드에서 알림 팝업이 안되는 이슈를 해결하고 싶습니다..계속 찾아봐도 답을 못 찾겠어서 질문 남깁니다!

// AndroidManifest.xml
<meta-data android:name="com.dieam.reactnativepushnotification.notification_foreground" android:value="true"/>
<!-- Change the resource name to your App's accent color - or any other color you want -->
<meta-data  android:name="com.dieam.reactnativepushnotification.notification_color"
                    android:resource="@color/white"/> <!-- or @android:color/{name} to use a standard color -->

<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationActions" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver" android:exported="true">
   <intent-filter>
      <action android:name="android.intent.action.BOOT_COMPLETED" />
      <action android:name="android.intent.action.QUICKBOOT_POWERON" />
      <action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
   </intent-filter>
</receiver>
<service
   android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
   android:exported="false" >
   <intent-filter>
      <action android:name="com.google.firebase.MESSAGING_EVENT" />
   </intent-filter>
</service>

// App.tsx
PushNotification.configure({
     onNotification: function (notification: any) {
         PushNotification.localNotification({
             message: notification.message,
             title: notification.title,
             channelId: 'channel_general',
         })
    }
})

PushNotification.createChannel(
    {
        channelId: 'channel_general',
        channelName: '앱', 
    },
    (created: boolean) => console.log(`createChannel returned '${created}'`),
);

react-native fcm push-notification library

답변 1

0

제로초(조현영)

팝업이라는 게 뭔지 이해가 잘 안 되는데요. 다른 앱중에 팝업이 뜨는 예시가 있을까요??

0

Oim

image포그라운드에서 상단에 뜨는걸 말한건데 팝업이라는 표현이 맞는지 모르겠네요.

이외에도 인스타에서도 포그라운드 상태에서 상단에 알림이 뜨는걸로 알고있습니다.

저도 이렇게 띄우고 싶은데 localNotification으로는 data: {} 빈 오브젝트로 넘어와서 활용하기 어려울거 같고

onNotification으로 발생하는 알림은 data가 정상적으로 넘어와서 onNotification으로 오는 알림을 팝업?시키고 싶습니다

1

제로초(조현영)

https://github.com/zo0r/react-native-push-notification#notification-importance

https://github.com/zo0r/react-native-push-notification#notification-priority

importance랑 priority 옵션을 high로 올려보세요.

0

Oim

엇 됩니다! 감사합니다 :)

앱실행시 네이버맵 [401] 에러

0

971

2

스타일링 라이브러리

0

147

2

expo, cli 선택 중에 고민이 있습니다.

0

167

2

JDK 버전이 달라도 괜찮나요?

0

223

2

dimenstion usewindowdeminstion

0

121

3

[맥 전용]환경 설정하기 1편 & [맥 전용]환경 설정하기 2편의 영상이 안나옵니다.

0

210

1

jdk11 버전과 gradle 버전의 호환성 관련 질문드립니다.

0

399

2

강의 외 질문입니다!

0

157

2

react native랑 맞는 ui 라이브러리 어떤게 좋을까요?

0

1496

2

react native와 spring boot 연결

0

355

1

java가 아닌 .kt에서 code push 에러가 발생합니다.

0

213

2

flipper 239 에러가 발생합니다.

0

164

2

package.json에 /lib/panino.js 문제입니다.

0

467

2

window - mac 협업 과정 질문합니다

0

214

1

ios 빌드 중 RCTBridgeDelegate.h import 오류

0

289

2

ios 앱 빌드 중 hermesEnabled 관련 오류발생

0

239

2

Socket 연결시 질문 드립니다.!

0

151

2

wifi 환경에서 axios 통신이 로컬서버에서 안됩니다.

0

426

2

iOS render error 질문드립니다.

0

410

2

iOS 가상머신 오류

0

164

2

npc react init 명령어 실행시 발생되는 오류

0

220

1

nom start 시 오류

0

116

1

NextJS 기반으로 만들어서 웹뷰 React Native로 배포 가능한가요?

0

1001

2

안드로이드 rn75 버전에 맞게 설정 중에 android13 다운로드에 대해서 막혔습니다!

0

183

2