Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/180.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 本地通知不起作用2_Android_Notifications_Ionic2_Local - Fatal编程技术网

Android 本地通知不起作用2

Android 本地通知不起作用2,android,notifications,ionic2,local,Android,Notifications,Ionic2,Local,我正在尝试添加本地通知,但我不知道我的错误在哪里。没有错误,但当我在手机(android)上测试我的应用程序时,没有显示任何通知。以下是我的步骤: 1-安装 ionic plugin add de.appplant.cordova.plugin.local-notification npm install --save @ionic-native/local-notifications 2-app.module.ts import { LocalNotifications } from '@

我正在尝试添加本地通知,但我不知道我的错误在哪里。没有错误,但当我在手机(android)上测试我的应用程序时,没有显示任何通知。以下是我的步骤:

1-安装

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'
    });
 }
Home.html

<button ion-button full (click)="schedule()">test notification</button>
测试通知

通过将本地通知插件的名称添加到“config.xml”解决的问题

通过将本地通知插件的名称添加到“config.xml”解决的问题