Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70440

IONIC 4: Apple Device APNS token sometimes it is created, and other times it is not. How can I make sure it is created all the time?

$
0
0

I am developing an application for android and IOS, configure the firebase service to receive notifications. After setting up notifications, and trying receiving notifications. On android it works without problems.

In IOS, the following happens:

As I am testing, the application is still in development mode and I test it in “Test Flight”.

Notifications come and I can process them normal. But there is a point where I no longer receive notifications from firebase.

By testing and seeing the messages from the development console in IOS, I have managed to notice the following:

Initializing the application I see this in the logs

2020-06-12 17:52:14.127396-0400 PinFamily[1931:1674476] Device FCM Token: [redacted]
2020-06-12 17:52:14.127396-0400 PinFamily[1931:1674476] Device APNS Token: [redacted]

In this case I got the firebase notifications, perfectly. But when I compiled and install again, the FCM token is created but not the APNS token.

Only this line appears:

2020-06-12 17:52:14.127396-0400 PinFamily[1931:1674476] Device FCM Token: [redacted]

And I dont received any firebase notifications.

I have to compile and reinstall the app, several times until the APNS token is created again, and I can received again firebase notifications.

Here is my code:

File: app.component.ts

 initializeApp() {
    this.platform.ready().then(() => {



window['FCMPlugin'].requestPushPermissionIOS((response) => {
  console.log('permission given', response);
}, (response) => {
  console.log('permission rejected', response);
});


this.fcm.getToken().then(token => {
            console.log("Inicializacion: "+token);
    });


    this.fcm.onNotification().subscribe(data => {
  }
});




   });
  }

How can I force the apns token to be created every time the device is installed?

My plugins: enter image description here

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 70440

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>