flurry / react-native-flurry-sdk

React Native Flurry SDK
Apache License 2.0
45 stars 13 forks source link

Retrieve FCM Device Token #36

Closed nidhinprathap closed 2 years ago

nidhinprathap commented 3 years ago

Describe the bug Is there a way to retrieve the device push notification token? Need to retrieve the token and save it.

This Bug is About Please choose the closest item by replacing [ ] with [x].

Platform Please choose the platform(s) that you are having the issue by replacing [ ] with [x].

Environment

Add any other context about the problem here.

Below Method "onTokenRefresh" gets fired before I can add a messaging listener, so the event is never triggered as sEnableMessagingListener false at that time.

@Override
        public void onTokenRefresh(String token) {
            if (sEnableMessagingListener && (sReactApplicationContext != null)) {
                sendEvent(EventType.TokenRefresh, token);
            }
        }
poting-oath commented 3 years ago

@nidhinprathap Thanks for the info! We will keep the token when onTokenRefresh been called. Then send event with the token to the React Native listener when registering.

nidhinprathap commented 3 years ago

@poting-oath Thanks & Yes, that will helpful, or even exposing a method to get the token from the native side also will be good, so that I can retrieve the token whenever I want. This would require saving the device token in local storage or sharedpref.

poting-oath commented 3 years ago

@nidhinprathap I have fixed the token refresh callback. The fix will be available in the next release.

nidhinprathap commented 3 years ago

@poting-oath when can I expect the release? or can a patch be released ?

poting-oath commented 3 years ago

@nidhinprathap We plan to release a new build in the next few weeks. However you can use the attached patch to update your local node_modules/react-native-flurry-sdk. RNToken.patch.gz

poting-oath commented 3 years ago

@nidhinprathap react-native-flurry-sdk 7.0.0 released with the fix. Thanks!