2017-10-28 20 views
0

Ich versuche, lokale Benachrichtigungen hinzufügen, aber ich weiß nicht, wo ist mein Fehler. Es gibt keine Fehler, aber wenn ich meine App auf Handy (Android) getestet, dann keine Benachrichtigung angezeigt. Hier sind meine Schritte:Lokale Benachrichtigung funktioniert nicht ionischen 2

1- Installations

ionic plugin add de.appplant.cordova.plugin.local-notification 
npm install --save @ionic-native/local-notifications 

2- app.module.ts

import { LocalNotifications } from '@ionic-native/local-notifications'; 
providers: [..., LocalNotifications] 

3-

Home.ts

import { LocalNotifications } from '@ionic-native/local-notifications'; 
constructor(..., public localNotifications: LocalNotifications) {} 

schedule() { 
    let date= new Date(new Date().getTime() + 5 * 1000); 
    alert("Your notification will be shown at " + date); 
    this.localNotifications.schedule({ 
     id: 1, 
     title: "Test Title", 
     text: "Delayed Notification", 
     at: date, 
     //sound: null, 
     //every: 'week' 
    }); 
} 

Startseite .html

<button ion-button full (click)="schedule()">test notification</button> 

Antwort

1

Das Problem ist gelöst, indem der Name der lokalen Benachrichtigung Hinzufügen von Plug-in "config.xml"

Verwandte Themen