EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 444 forks source link

Please, need clarification/help: Do I need nativescript-local-notification #1485

Closed sudiptosen closed 4 years ago

sudiptosen commented 4 years ago

Hi @EddyVerbruggen thanks for all the good work on this.

I am just getting started, can't seem to see any Notification on iOS. I tried using showNotificationsWhenInForeground on both firebase init and during registerForPushNotifications just to make sure that I am not missing anything. At this point, I am thinking if I HAVE TO use the local-notification plugin.

Can you please make it clear, if that's a requirement or not?

Appreciate it.

import {Component, OnInit} from "@angular/core";
import * as firebase from 'nativescript-plugin-firebase';

@Component({
    selector: "ns-app",
    templateUrl: "app.component.html"
})
export class AppComponent implements OnInit{
  async ngOnInit() {

    // Firebase Init
    try {
      await firebase.init({
        showNotifications: true,
        showNotificationsWhenInForeground: true
      });
      console.log(`Firebase Initialized.`);
    }
    catch (e) {
      console.log(`Error: ${e}`);
    }

    // Register for Push Token
    try {
      await firebase.registerForPushNotifications({
        showNotifications: true,
        showNotificationsWhenInForeground: true
      });
      console.log(`Requested Registration for Push`);
    }
    catch (e) {
      console.log(`Error: Requesting Registration for Push`);
    }

    // Receiving message
    await firebase.addOnMessageReceivedCallback((message) => {
      console.log(`==========================================`);
      console.log(`Delivered`);
      console.log(`${JSON.stringify(message, null, 2)}`);
      console.log(`==========================================`);
    });

    // Got token
    await firebase.addOnPushTokenReceivedCallback((token) =>{
      console.log(`Got the Token: ${token}`);
    });
  }
}
EddyVerbruggen commented 4 years ago

No, the loacl notifications plugin is not needed. It must be something in your configuration. Please see the demo folder in this repo for an example - also check the files in app_resources/ios.

sudiptosen commented 4 years ago

Hi @EddyVerbruggen, have tried so many times. Kind a desperate at this point. So just adding a repo. If you can take a quick look, really appreciate it.

Repo HERE

sudiptosen commented 4 years ago

No, the loacl notifications plugin is not needed. It must be something in your configuration. Please see the demo folder in this repo for an example - also check the files in app_resources/ios.

Thanks Eddy, I still couldn't get it to work. So put in a full project. Must be something obvious