Send Ionic 3 Local Notification every day at a specific time

前端 未结 4 939
慢半拍i
慢半拍i 2021-01-23 07:05

I have added the Ionic 3 local notification plugin to my project using these commands:

ionic cordova plugin add cordova-plugin-local-notification
npm install --s         


        
4条回答
  •  一个人的身影
    2021-01-23 07:36

    So I found the solution to this one by myself. It's an error in the typings file of LocalNotifications package.

    The correct usage for the options look like this:

        {
          id: 1,
          title: 'Notification Title',
          text: 'Your notification text',
          foreground: true,
          trigger: {
            every: {
              hour: 8,
              minute: 15
            }
          }
        }
    

    Just go into your node_modules/@ionic-native/local-notifications find the index.d.ts and find the line which says every?: ELocalNotificationTriggerUnit and change it to every?: any; now it should work perfectly.

提交回复
热议问题