phonegap/phonegap-plugin-push

iOS Push notifications generates APNS Token and then FCM Token

danielsotopino opened this issue · 1 comments

On a previous version of my app, this problem wasn't happening, i received only apns token and would receive push notifications only. Now the log shows how the apns token is being generated and afterwards the fcm token is generated.

I believe this behaviour should be happening on 2.3.0 as well.

Expected Behaviour

Disable FCM Notifications on iOS by setting IS_GCM_ENABLED false on plist file, receive only APNS token.

Actual Behaviour

APNS token is received but then tokenRefresh method is activated and generates an FCM token.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

iOS 12+

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

N/A

Cordova CLI version and cordova platform version

cordova --version 9.0.0
cordova platform version ios 5.0.1

Plugin version

phonegap-plugin-push 2.2.3 "PushPlugin"

Logs taken while reproducing problem

[825:181768] Using APNS Notification
[825:181689] The FCM registration token needs to be changed.
[825:181689] FCM Registration Token: xxxx

I believe the issue is with the piece of code that enables configuration of fcm tokens, even though i wanted to work with apns tokens.

[[NSNotificationCenter defaultCenter]
         addObserver:self selector:@selector(onTokenRefresh)
         name:kFIRInstanceIDTokenRefreshNotification object:nil];

        [[NSNotificationCenter defaultCenter]
         addObserver:self selector:@selector(sendDataMessageFailure:)
         name:FIRMessagingSendErrorNotification object:nil];

        [[NSNotificationCenter defaultCenter]
         addObserver:self selector:@selector(sendDataMessageSuccess:)
         name:FIRMessagingSendSuccessNotification object:nil];

        [[NSNotificationCenter defaultCenter]
         addObserver:self selector:@selector(didDeleteMessagesOnServer)
         name:FIRMessagingMessagesDeletedNotification object:nil];