fcm-ng
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

fcm-ng (aka FCMNG)

This is a wrapper for using cordova-plugin-fcm-ng with Ionic projects instead to install @ionic-native/fcm.

This plugin works with any version of cordova-plugin-fcm-ng, but only v4 or higher support Google Analytics for tracking events.

Requirements

Make sure you have cordova-plugin-fcm-ng installed.

cordova plugin add cordova-plugin-fcm-ng
 

See this guide for more details

Installation

Run following command to install the FCMNG wrapper in your project.

npm install fcm-ng --save

Basic Usage

To use this plugin, import and add it to provider and inject it where you wish to use.

// app.module.ts
import { FCMNG } from 'fcm-ng';
 
...
 
@NgModule({
  ...
 
  providers[
    ...
    FCMNG
    ...
  ]
  ...
})
export class AppModule { }
import { FCMNG } from 'fcm-ng';
import { Platform } from 'ionic-angular';
 
@Component({ ... })
export class MyComponent {
 
  constructor(private FCMPlugin: FCMNG, private platform: Platform) {
 
    this.platform.ready().then(() => {
 
      this.FCMPlugin.logEvent('test_event', { param1: 'param_1' }).then(res => {
        // OK
      }).catch(e => {
        // Error
      });
 
      this.FCMPlugin.setUserId('tester1234').then(res => {
        // OK
      }).catch(e => {
        // Error
      });
 
      this.FCMPlugin.setUserProperty('test_property', 'test1').then(res => {
        // OK
      }).catch(e => {
        // Error
      });
    });
  }
}

License

FCMNG is released under the MIT License. Please refer to the LICENSE file that accompanies this project for more information including complete terms and conditions.

Readme

Keywords

none

Package Sidebar

Install

npm i fcm-ng

Weekly Downloads

24

Version

2.1.0

License

MIT

Unpacked Size

24.4 kB

Total Files

9

Last publish

Collaborators

  • cmgustavo
  • ematiu