react-native-pusher-push-notifications icon indicating copy to clipboard operation
react-native-pusher-push-notifications copied to clipboard

Has anyone got this to work on Android?

Open jm90m opened this issue 3 years ago • 3 comments
trafficstars

Hello,

I've followed the setup exactly for android, not too sure what I am missing.

Project is here - https://github.com/snapshot-labs/snapshot-app

I can't seem to receive a notification on my android device. This function never gets called handleNotification

RNPusherPushNotifications.on("notification", handleNotification);

I know people are busy, so I can offer crypto for someones time on helping me with this issue.

jm90m avatar Mar 03 '22 19:03 jm90m

hi, you can try this methods..

RNPusherPushNotifications.on('notification',(notification) => { handleNotification(notification); });

const handleNotification = async (notification) => { screen.props.getNotifications(10, screen, screen.props.navigation); // iOS app specific handling if (Platform.OS === 'ios') { switch (notification.appState) { case 'inactive': // inactive: App came in foreground by clicking on notification. // Use notification.userInfo for redirecting to specific view controller case 'background': // background: App is in background and notification is received. // You can fetch required data here don't do anything with UI case 'active': // App is foreground and notification is received. Show a alert or something. default: break; } } else { // console.log("android handled notification..."); } };

Thavananthan avatar Mar 21 '22 05:03 Thavananthan

Using this lib with react-native-notifications helped a lot for Android, its working fine here with background and foreground notifications.

gabrielbezerra81 avatar Apr 03 '22 00:04 gabrielbezerra81

@gabrielbezerra81 How do you integrate it with pusher?

anastely avatar Apr 07 '22 10:04 anastely