React-native-push-notification: getToken() ?

Created on 14 Dec 2016  路  5Comments  路  Source: zo0r/react-native-push-notification

Hi,

The plugin works great for the case when the app is used only by one user per device since the onRegister() function is only called once.

In my app, I can logout and login with another account, but the onRegister function is not called anymore (since the device is already registered).

Is there a way to get the deviceToken from the PushNotification object?
If not, I certainly can store the device Token in AsyncStorage, but if the token changes from APN, does it call onRegister() function ?

Stale

Most helpful comment

@Crash-- looks like you don't get a token in the simulator, so onRegister never fires. Needs to run on a real physical device. README should probably be updated.

All 5 comments

@Crash-- I think you can just call the requestPermissions method whenever the user signs in which should get a new device token and call the onRegister handler.

@Crash-- looks like you don't get a token in the simulator, so onRegister never fires. Needs to run on a real physical device. README should probably be updated.

I think this is detailed in the trouble shooting guide. If not it should be

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings