GithubHelp home page GithubHelp logo

Comments (5)

TravBradfield avatar TravBradfield commented on July 16, 2024 2

So I figured out what my issue was. I had not called Plugins.PushNotifications.register();

Once I had done that then I was in the clear.

from fcm.

Simbaclaws avatar Simbaclaws commented on July 16, 2024 1

Sorry for reopening this issue but I am getting the same error message in my console and PushNotifications.register returns an empty value.
I am calling it like this:

PushNotifications.requestPermission().then( result => {
      if (result.granted) {
        // Register with Apple / Google to receive push via APNS/FCM
        PushNotifications.register().then((value) => {
          console.log("registration token: ", value);
        }).catch((error) => {
          console.error(error);
        });
      } else {
        // Show some error
        console.error("registration failed");
      }
    });

The request permission dialog comes up and when I click allow it tells me:
registration token: {}

from fcm.

stewones avatar stewones commented on July 16, 2024

closing as it seem to be sorted out

from fcm.

Artkoch avatar Artkoch commented on July 16, 2024

I'm having the same issue. I init it in the index.tsx the following way

const setupPushNotifications = async () => {
  if (!isPushNotificationsAvailable) return;
  const primission = await PushNotifications.requestPermission();

  if (primission.granted) {
    PushNotifications.addListener("registration", (token) => {
      console.log("FCMPlugin.getToken()", FCMPlugin.getToken());
      console.log("registration token: ", token);
    });
    
    PushNotifications.register();
  }
};

setupPushNotifications();

My log, looks like this
image

from fcm.

jcardus avatar jcardus commented on July 16, 2024

hey @Artkoch, FCMPlugin.getToken returns a promise, if you wait for it you should get your firebase token.

from fcm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.