react-native-voip-push-notification: register event not working
I looked at all the solutions offered, I looked at the answers to those who shared this error before, but none of them worked. I have been working for 1 day and haven’t even once received a token. I’ve tried it on a few phones. It doesn’t work. Please help.
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
[RNVoipPushNotificationManager voipRegistration];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"Myapp"
initialProperties:nil];
/* Add PushKit delegate method */
// --- Handle updated push credentials
- (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(PKPushType)type {
// Register VoIP push token (a property of PKPushCredentials) with server
[RNVoipPushNotificationManager didUpdatePushCredentials:credentials forType:(NSString *)type];
}
- (void)pushRegistry:(PKPushRegistry *)registry didInvalidatePushTokenForType:(PKPushType)type
{
// --- The system calls this method when a previously provided push token is no longer valid for use. No action is necessary on your part to reregister the push type. Instead, use this method to notify your server not to send push notifications using the matching push token.
}
import VoipPushNotification from 'react-native-voip-push-notification';
VoipPushNotification.addEventListener('register', (token) => {
console.log(token, "voip token");
});
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (8 by maintainers)
94c19d0be742ce6ab01ea2545fb2a5518c1dcac3044f62ca666ae9cdb8b6eabais this a true voip token?When i try like this its work.
Before i removed this from appdelegate.m
[RNVoipPushNotificationManager voipRegistration];Is it simulator?
Thanks @Romick2005 for the help.
@CMLCNL please try 3.1.0, now it fires
registerenevt with the latest cached token for you if you have register voip token on the native side and callregisterVoipTokenon JS side again.