2017-12-31 122 views
1

Ich arbeite mit ionic 2 lokale Benachrichtigung zum ersten Mal. Ich bin diesem YouTube tutorial gefolgt.ionic 2 lokale Benachrichtigung nicht angezeigt

Wenn ich meine App in Xcode testen, erhalte ich eine Warnmeldung unten und die Benachrichtigung zeigt nicht ... nicht sicher warum.

WARN: Unknown property: at

Ich habe installiert

ionic cordova plugin add de.appplant.cordova.plugin.local-notification

npm install --save @ionic-native/local-notifications

und hinzugefügt, um das Plugin als Anbieter in src/app/app.module.ts

Ich habe folgenden Code:

home.html:

<button ion-button (click)=myNotifications()>Test</button> 

app.module.ts

import { Component } from '@angular/core'; 
import { NavController, Platform, ActionSheetController, AlertController } from 'ionic-angular'; 
import { ScreenOrientation } from '@ionic-native/screen-orientation'; 
import { LocalNotifications } from '@ionic-native/local-notifications'; 


    export class HomePage { 

     constructor(public navCtrl: NavController, 
        public platform: Platform, 
        private screenOrientation: ScreenOrientation, 
        private localNotifications: LocalNotifications, 
        public alertCtrl: AlertController) { 

        this.platform.ready().then((ready) =>{ 
         this.localNotifications.on('click', (notification, state) => { 
         let json = JSON.parse(notification.data); 

         let alert = this.alertCtrl.create({ 
          title: notification.title, 
          message: json.fullMsq 
         }); 
         alert.present(); 
         }); 
        }); 
     } 

     myNotifications() { 

     this.localNotifications.schedule({ 
      id: 1, 
      title: 'ABC Meeting Notification', 
      text: 'ABC Meeting will start in 20 mins', 
      at: new Date(new Date().getTime() + 20*60*1000), 
      data: { fullMsq: 'this is the full notification message' } 
     }) 
     } 

    } 

Antwort

1

Mitteilung Demo Siehe: https://github.com/husainsr/Ionic3_Notification kann es Ihnen Beweist Hilfreiche.

+0

Befolgen Sie die Anweisungen und installiert die App auf Android-Gerät und Xcode-Simulator, die Datumsauswahl nicht angezeigt oder die Gerätetastatur. Daher können die Benachrichtigungen nicht getestet werden. – GreenDome

+0

können Sie bitte überprüfen Sie es und geben Sie mir mehr Informationen, wenn es einen Fehler gibt oder nicht? – Husain

+0

FEHLER Fehler: Ungefangen (in Versprechen): cordova_not_available – GreenDome

Verwandte Themen