Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cmgustavo/fcm-ng
Ionic wrapper for cordova-plugin-fcm-ng (includes Google Analytics)
https://github.com/cmgustavo/fcm-ng
Last synced: about 1 month ago
JSON representation
Ionic wrapper for cordova-plugin-fcm-ng (includes Google Analytics)
- Host: GitHub
- URL: https://github.com/cmgustavo/fcm-ng
- Owner: cmgustavo
- License: mit
- Created: 2019-06-28T13:45:47.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-10T21:30:07.000Z (about 1 year ago)
- Last Synced: 2024-10-10T01:21:21.985Z (about 1 month ago)
- Language: TypeScript
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
```Bash
cordova plugin add cordova-plugin-fcm-ng```
See [this guide](https://github.com/cmgustavo/cordova-plugin-fcm) for more details## Installation
Run following command to install the FCMNG wrapper in your project.
```bash
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.```typescript
// app.module.ts
import { FCMNG } from 'fcm-ng';...
@NgModule({
...providers: [
...
FCMNG
...
]
...
})
export class AppModule { }
``````typescript
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](https://github.com/bitpay/copay/blob/master/LICENSE) file that accompanies this project for more information including complete terms and conditions.