localNotification android 작동안함
PushNotification.localNotification 이 포그라운드 일떄
안드로이드에서 백그라운드 때처럼 알림동작을 하지 않습니다.
메니페스트는 잘 추가한 상태입니다.
<meta-data android:name="com.dieam.reactnativepushnotification.notification_foreground"
android:value="true"/>
.....
onNotification: function (notification: any) {
if (notification.channelId === 'riders') {
console.log('NOTIFICATION riders:', notification);
if (notification.message || notification.data.message) {
const title = notification.title || notification.data.title;
const message = notification.message || notification.data.message;
//Alert.alert(title, message, [{text: '확인'}]);
if (notification.foreground) {
PushNotification.localNotification({
channelId: 'riders',
autoCancel: true,
title: 'title',
message: 'message',
invokeApp: true,
});
}
}
}
notification.finish(PushNotificationIOS.FetchResult.NoData);
}
.....
onNotification이 펑션은 잘 물고 들어옵니다.
console.log('NOTIFICATION:', notification);로그도 잘 찍히구요.
하지만 이 안에서 선언한
PushNotification.localNotification펑션이 전혀 반응이 없습니다.
가이드를 정독해도 제가 놓친 부분이 없네요...
포그라운드일때도 백그라운드일때처럼 알림이 오길 원해서 추가한 코드인데 되지를 않네요 ...
혹시 이에대해서 해답을 아시면 공유 부탁드립니다. ㅜ
답변 2
0
소중한 답변 감사합니다.
원인은 정말 바보같게도 다른 곳에 있었으며 안드로이드를 아직 잘 이해하지 못한 저에게 있었습니다.
....
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
....intent-filter 에 메인, 런처 가 포함한 곳에 다 같이 넣어버리면 앱아이콘이 사라지는 이슈가 있었습니다.
제가 직면했던 문제였고 이 이슈를 해결하니까 포그라운드 알림도 동작하기 시작했습니다.
수정된 코드는 다음과 같습니다.
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>다음과 같이 인텐트 필터를 메인과 뷰를 분리해서 등록해야합니다.
앱실행시 네이버맵 [401] 에러
0
993
2
스타일링 라이브러리
0
148
2
expo, cli 선택 중에 고민이 있습니다.
0
167
2
JDK 버전이 달라도 괜찮나요?
0
225
2
dimenstion usewindowdeminstion
0
122
3
[맥 전용]환경 설정하기 1편 & [맥 전용]환경 설정하기 2편의 영상이 안나옵니다.
0
211
1
jdk11 버전과 gradle 버전의 호환성 관련 질문드립니다.
0
400
2
강의 외 질문입니다!
0
157
2
react native랑 맞는 ui 라이브러리 어떤게 좋을까요?
0
1504
2
react native와 spring boot 연결
0
356
1
java가 아닌 .kt에서 code push 에러가 발생합니다.
0
215
2
flipper 239 에러가 발생합니다.
0
165
2
package.json에 /lib/panino.js 문제입니다.
0
471
2
window - mac 협업 과정 질문합니다
0
215
1
ios 빌드 중 RCTBridgeDelegate.h import 오류
0
289
2
ios 앱 빌드 중 hermesEnabled 관련 오류발생
0
240
2
Socket 연결시 질문 드립니다.!
0
152
2
wifi 환경에서 axios 통신이 로컬서버에서 안됩니다.
0
427
2
iOS render error 질문드립니다.
0
410
2
iOS 가상머신 오류
0
166
2
npc react init 명령어 실행시 발생되는 오류
0
221
1
nom start 시 오류
0
116
1
NextJS 기반으로 만들어서 웹뷰 React Native로 배포 가능한가요?
0
1002
2
안드로이드 rn75 버전에 맞게 설정 중에 android13 다운로드에 대해서 막혔습니다!
0
185
2





