Surely, This is my app.module.ts
import { CloudSettings, CloudModule } from '@ionic/cloud-angular';
...
const cloudSettings: CloudSettings = {
'core': {
'app_id': 'aff7d862',
},
'push': {
'sender_id': '1014472767909',
'pluginConfig': {
'ios': {
'badge': true,
'sound': true
},
'android': {
'iconColor': '#343434'
}
}
}
};
@NgModule({
declarations: [
MyApp,
Login,
Artists,
Artist,
Calendar,
PopoverPage,
AddapptmodalPage,
ModifyapptmodalPage,
Register,
Chathub,
Chat,
SwipeVertical,
FormatTime
],
imports: [
IonicModule.forRoot(MyApp),
BrowserModule,
FormsModule,
ElasticModule,
HttpModule,
CalendarModule.forRoot(),
CommonModule,
CloudModule.forRoot(cloudSettings)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
Login,
Artists,
Artist,
Calendar,
PopoverPage,
AddapptmodalPage,
ModifyapptmodalPage,
Register,
Chathub,
Chat
],
providers: [
{ provide: ErrorHandler, useClass: IonicErrorHandler },
UserSingleton,
SendBirdCtrl,
FormatTime,
AjaxMethods,
{ provide: HAMMER_GESTURE_CONFIG, useClass: MyHammerConfig }]
})
Then on the login page (which is the root of the app) there is this
import { Push, PushToken } from '@ionic/cloud-angular';
...
constructor(public navCtrl: NavController, private http: Http, private menu: MenuController, public currUser: UserSingleton,
public modalCtrl: ModalController, public platform: Platform, public push: Push)
{
this.push.register().then((t: PushToken) =>
{
return this.push.saveToken(t);
}).then((t: PushToken) =>
{
this.currUser.setValue("devicetoken", t.token);
});
this.push.rx.notification()
.subscribe((msg) =>
{
alert(msg.title + ': ' + msg.text);
});
}
Right now it is a straight copy paste from https://docs.ionic.io/services/push/ just so I can get it working then I’ll go off making it more complex, but not even the base code from the docs works.