@hieutq wrote:
Hi everybody!
I’m trying with new plugin ionic-native/firebase, I already install this plugin but it not working.
I did all step bellow:
install plugin:ionic cordova plugin add cordova-plugin-firebase npm install --save @ionic-native/firebasecreate application on firebase (same bundle id) and get certificate file, and
download google-services.json add to plugin >> cordova-plugin-firebase >> src >> android >> google-services.json download GoogleService-Info.plist add to plugin >> cordova-plugin-firebase >> src >> ios >> GoogleService-Info.plistadd to app.module.ts (include prodivers)
add to app.component.ts
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, private firebase: Firebase) { platform.ready().then(() => { statusBar.styleDefault(); splashScreen.hide(); this.firebase.grantPermission(); this.firebase.getToken() .then(token => { console.log(`The token is ${token}`); }) // save the token server-side and use it to push notifications to this device .catch(error => console.error('Error getting token', error)); this.firebase.onTokenRefresh() .subscribe((token: string) => console.log(`Got a new token ${token}`)); this.firebase.onNotificationOpen().; }); }when i run application on ios application popup to get notification permission, and print token to console log, but when i push notification from firebase, don’t have anything.
so, I have 2 question, pls help me
Question 1: what is missing in my code? how to fix.
Question 2: I want filter notification before show, for example:1, I have alot of customer, and separate to 2 zone: green or red, 2, when I push notification from firebase {data: {condition: 1 or 2}, 3, all device will get this one, but must filter: if condition = 1, 4, only green customer show it, if condition = 2, only red customer show itI think a lot of people have same question.
Posts: 1
Participants: 1