728x90
- 사용 라이브러리
https://github.com/zo0r/react-native-push-notification
- 환경
RN 0.61.5
- 버그
안드로이드 설치 따라하고, local notification을 실행시켜 봤는데, 알림이 멈추지 않고 계속 왔다.
Android Notification Keep showing infinitely.
- Usage
PushNotification.localNotification({
/* Android Only Properties */
id: '0', // (optional) Valid unique 32 bit integer specified as string. default: Autogenerated Unique ID
ticker: "My Notification Ticker", // (optional)
autoCancel: true, // (optional) default: true
largeIcon: "ic_launcher", // (optional) default: "ic_launcher"
smallIcon: "ic_notification", // (optional) default: "ic_notification" with fallback for "ic_launcher"
bigText: "My big text that will be shown when notification is expanded", // (optional) default: "message" prop
subText: "This is a subText", // (optional) default: none
color: "red", // (optional) default: system default
vibrate: true, // (optional) default: true
vibration: 300, // vibration length in milliseconds, ignored if vibrate=false, default: 1000
tag: 'some_tag', // (optional) add tag to message
group: "group", // (optional) add group to message
ongoing: false, // (optional) set whether this is an "ongoing" notification
priority: "high", // (optional) set notification priority, default: high
visibility: "private", // (optional) set notification visibility, default: private
importance: "high", // (optional) set notification importance, default: high
/* iOS only properties */
alertAction: // (optional) default: view
category: // (optional) default: null
userInfo: // (optional) default: null (object containing additional notification data)
/* iOS and Android properties */
title: "My Notification Title", // (optional)
message: "My Notification Message", // (required)
playSound: false, // (optional) default: true
soundName: 'default', // (optional) Sound to play when the notification is shown. Value of 'default' plays the default sound. It can be set to a custom sound such as 'android.resource://com.xyz/raw/my_sound'. It will look for the 'my_sound' audio file in 'res/raw' directory and play it. default: 'default' (default sound is played)
number: '10', // (optional) Valid 32 bit integer specified as string. default: none (Cannot be zero)
repeatType: 'day', // (optional) Repeating interval. Check 'Repeating Notifications' section for more info.
actions: '["Yes", "No"]', // (Android only) See the doc for notification actions to know more
});
코드 위와 같았다. (깃헙 예제 그대로 사용)
그래서 아래 링크를 보고 repeatType을 주석 처리 해봤더니 알림이 한 번만 왔다.
repeatType에 버그가 있는걸까?
https://github.com/zo0r/react-native-push-notification/issues/374
근데 localSchedule? 이거 쓰면 repeat 할 수 있는 것 같음.
그리고 date set을 잘하래. 이거는 알람 반복설정? 같은거 시도할 때 문제 생기면 다시 참고해보자.
https://github.com/zo0r/react-native-push-notification/issues/270
같은 분이 date set을 강조하시네.. 참고!
'Develop > React Native' 카테고리의 다른 글
React native paper (0) | 2020.03.12 |
---|---|
React Native Boiler Plate NPM package (0) | 2020.03.11 |
[React Native] NFC 스캔 - 안드로이드 (0) | 2020.03.03 |
[React Native] react-navigation ***v5*** 사용법 (0) | 2020.02.17 |
[React / RN] Styled Component 💅🏻 (0) | 2020.02.16 |