Reputation: 357
I'm using Ionic to add iOS and Android Push notifications.
I have it working for iOS, but I'm not sure how to initialize using Android. Every time I enter the ID with the firebase ID, it gives me an error. Do I need to double initialize?
Code:
iOS
this.oneSignal.startInit('3234fwfe-923s-4fb2-23r3-723r3ef32');
How would I initialize the android/Firebase code as well? It gives me an error when I put in the parentheses above
Android/Firebase Is this Best practice?
this.oneSignal.startInit('ucsgi232-2322-fwe1-few4-wfefw232rff3','123456789011 );
Upvotes: 1
Views: 559
Reputation: 1224
Check Platform and then select initialize method:
import { Platform } from 'ionic-angular';
constructor(private oneSignal: OneSignal,
private platform: Platform) { }
initializeOneSignal() {
....
if (this.platform.is('android')) {
this.oneSignal.startInit('ucsgi232-2322-fwe1-few4-wfefw232rff3', '123456789011');
}
else {
this.oneSignal.startInit('3234fwfe-923s-4fb2-23r3-723r3ef32');
}
.....
}
Upvotes: 1