1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Send Ionic 3 Local Notification every day at a specific time

Discussão em 'Angular' iniciado por Amanullah Aman, Setembro 12, 2024.

  1. 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 --save @ionic-native/local-notifications


    I added all dependencies on my constructor.

    My code is:

    let year = new Date().getFullYear();
    let month = new Date().getMonth();
    let day = new Date().getDate();

    let time1 = new Date(year, month, day, 10, 00, 0, 0);
    let time2 = new Date(year, month, day, 12, 00, 0, 0);

    this.localNotifications.schedule([
    {
    id: 1,
    title: 'My first notification',
    text: 'First notification test one',
    trigger: { at: new Date(time1) },
    data: {"id": 1, "name": "Mr. A"}
    },
    {
    id: 2,
    title: 'My Second notification',
    text: 'Second notification on 12 pm',
    trigger: { at: new Date(time2) },
    data: {"id": 2, "name": "Mr. B"}
    }
    ]);


    It works fine for the current day app start, but I want to send a notification every day at the specified time.

    I want local notifications specifically, not push notifications.

    Continue reading...

Compartilhe esta Página