2

I want to create FCM token for web application based on this i want to send push notifications.Is it possible?Can i expect sample code for this?

I try this one

  var config = {
    apiKey: "AIzaSyC2GoeeoYfPTgP61w77FMPFep-cLBz9Pmc",
    authDomain: "sample-3a7a1.firebaseapp.com",
    databaseURL: "https://sample-3a7a1.firebaseio.com",
    projectId: "sample-3a7a1",
    storageBucket: "sample-3a7a1.appspot.com",
    messagingSenderId: "990467369229"
  };
  firebase.initializeApp(config);
const messaging=firebase.messaging();
messaging.requestPermission()
.then(function(){
console.log('Have permission');
return messaging.getToken();
})
.then(function(token){
console.log(token);
})

but it shows following error

Uncaught e {code: "app/no-app", message: "Firebase: No Firebase App '[DEFAULT]' has been cre…- call Firebase App.initializeApp() (app/no-app).", name: "[DEFAULT]", stack: "FirebaseError: Firebase: No Firebase App '[DEFAULT…    at http://localhost:8080/FCMPushNotify/:88:30"}
AL.
  • 36,815
  • 10
  • 142
  • 281
  • Possible duplicate [Retrieving number of unacknowledged messages in RabbitMQ queue from Java/ Spring](http://stackoverflow.com/questions/13721066/retrieving-number-of-unacknowledged-messages-in-rabbitmq-queue-from-java-spring) – Fady Saad Apr 24 '17 at 06:25

0 Answers0