angular – how do I debug push notifications for iOS with Firebase

0
51


Trying to get my push notifications working on iOS, starting with my own iOS device

I am able to find my token in Angular, send it to my python backend and store it in a database.

If I go to Compose notification in firebase:
https://console.firebase.google.com/project//notification/compose
I’m able to create the campaign and receive my notification on my phone. However if I hit ‘Send test message’, enter (or check) my FCM token from the database and hit ‘Test’ There is no result.

So I am doubting my method to receive my token / if the token is correct.

I’m using Angular, and in my service I’m calling:

      PushNotifications.addListener('registration', (token: Token) => {
        console.log('Push registration success, token: ' + token.value);
        this.tokenvalue = token.value
        this.LogOn(username, password, this.tokenvalue)
      });    }

Its part of my login form, every time someone logs in the token gets retrieved in case its there:

import { PushNotifications, Token } from '@capacitor/push-notifications';
import { Capacitor } from '@capacitor/core';


(....)


  onSubmit(): void {

    const { username, password } = this.form;
    const isPushNotificationsAvailable = Capacitor.isPluginAvailable('PushNotifications');
     
    if (isPushNotificationsAvailable) {
      PushNotifications.requestPermissions().then(result => {
        if (result.receive === 'granted') {
          // Register with Apple / Google to receive push via APNS/FCM
          PushNotifications.register();
        } else {
          this.tokenvalue = ""
          this.LogOn(username, password, this.tokenvalue)
        }
      });
      PushNotifications.addListener('registration', (token: Token) => {
        console.log('Push registration success, token: ' + token.value);
        this.tokenvalue = token.value
        this.LogOn(username, password, this.tokenvalue)
      });    }

      else {
        this.tokenvalue = ""
        this.LogOn(username, password, this.tokenvalue)
      }

  }

The actual token I’m now trying looks like this:

5BA41427198D463847………………..80585EAFC3C2670226E22C082A

The 20 dots also represent actual characters like the other ones around it. It’s 64 characters in total.

Hope you can help me, am I doing something wrong here? Do I miss a setting somewhere?