我在我的Ionic 2項目中有下面的代碼,它會接收推送通知。當我運行代碼時,我在控制檯中不斷收到錯誤消息,提示沒有提供者用於推送。Ionic 2問題:沒有提供者推送
import { Component, ViewChild } from '@angular/core';
import { ionicBootstrap, Platform, Nav } from 'ionic-angular';
import { StatusBar, Splashscreen} from 'ionic-native';
import { CloudSettings, PushToken, Push } from '@ionic/cloud-angular';
@Component({
templateUrl:'build/app.html'
})
constructor(public platform: Platform, private userProvider: UserProvider, public push: Push) {const cloudSettings: CloudSettings = {
'core': {
'app_id': 'XXXXXXX',
},
'push': {
'sender_id': 'XXXXXXX',
'pluginConfig': {
'android': {
'iconColor': '#343434'
}
}
}
};
this.push.register().then((t: PushToken) => {
return this.push.saveToken(t);
}).then((t: PushToken) => {
console.log('Token saved:', t.token);
});
this.push.rx.notification()
.subscribe((msg) => {
alert(msg.title + ': ' + msg.text);
});
});
我想這是某種離子2版本不匹配,這裏是我的離子信息的詳細內容下面
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.11
Ionic CLI Version: 2.0.0
Ionic App Lib Version: 2.0.0-beta.20
OS: Distributor ID: Ubuntu Description: Ubuntu 14.04.3 LTS
Node Version: v4.5.0
我會考慮的錯誤消息說的話開始,並檢查,我確實在我的供應商列表中宣佈推。 –
發佈您的NgModule –
@JBNizet添加它檢查我的編輯 – kolexinfos