evollu / evollu/react-native-fcm
Action click push notifocation
- Dominant language
- Java
- Stars
- 1.7k
- Forks
- 661
- PR merge metrics
- No merged PRs in 30d
Description
I can't get action click push notification. I want get action click because after click will open url . Thank you.
## My code.
` componentDidMount() {
//console.log('wrapper did mount')
NetInfo.addEventListener('change', this._handleConnectionInfoChange );
NetInfo.fetch().done (
(connectionInfo) => { this._handleConnectionInfoChange(connectionInfo); }
);
//Config Push Notification
if(Platform.OS == 'ios') {
FCM.requestPermissions()
.then(e => {})
.catch(() => {})
}
FCM.getFCMToken().then(token => {
// console.log('token', token)
if(token && token != undefined) {
this._saveDeviceToken(token)
}
})
this.refreshTokenListener = FCM.on(FCMEvent.RefreshToken, (token) => {
// console.log('token refresh', token)
if(token && token != undefined) {
this._saveDeviceToken(token)
}
})
FCM.getInitialNotification().then(notification => {
if(notification && notification.opened_from_tray) {
this._openUrl(this.state.url);
}
});
this.notificationListener = FCM.on(FCMEvent.Notification, (notification) => {
if(notification)
{
const url_open = notification.url;
this.setState({
url: url_open ? url_open : false
})
if(notification.local_notification) {
if(notification.opened_from_tray) {
this._openUrl(this.state.url);
}
return;
}
if(notification.opened_from_tray) {
return;
}
const title = notification.fcm.title;
FCM.presentLocalNotification({
priority: 'high',
title: title ? title : Params.Name,
body: notification.fcm.body,
big_text: notification.fcm.body,
icon: 'pushicon',
large_icon: 'joinmunch',
url : url_open,
lights: true,
show_in_foreground: true,
local: true
})
FCM.cancelAllLocalNotifications()
}
})
}`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.