# Local Notification issue

**URL:** <https://forum.ionicframework.com/t/local-notification-issue/87473>\
**Category:** ionic-v3\
**Created:** [April 22, 2017, 6:18pm UTC](https://forum.ionicframework.com/t/local-notification-issue/87473 "2017-04-22T18:18:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![techsnake](https://avatars.discourse-cdn.com/v4/letter/t/7ab992/32.png) [@techsnake](https://forum.ionicframework.com/u/techsnake)\
**Post date:** [April 22, 2017, 6:18pm UTC](https://forum.ionicframework.com/t/local-notification-issue/87473/1 "2017-04-22T18:18:26Z")

</div>

Local notfication is getting a major problem to me !

```auto
schedule(){
 let now = new Date().getTime();
    let time1=new Date(now+60000);
this.localNotifications.schedule({
            id:1,
            title: "deneme",
            text: "Biraz kelime çalışalım mı ?",
            at: time1,
            sound: "file://assets/sound/speed_camera.mp3",
           
        }

}

```

Local notification is used with backgroundmode plugin .

I got interesting unexpexted behavior.When the phone is awake it works fine .However when the phone is in sleep(locked and blackscreen) ,LocalNotification is sometimes triggered sometimes not but even if it works ,it has a delay from 5 mins to 15 mins.

```auto
* Version of Plugin:@ionic-native/local-notifications": "^3.5.0",
*Platform Android
*OS :Windows 10
*Lenova A6020a41 Android version 5.1
*Cordova version 6.5
*Installed platforms: android 6.1.2

```

If needs more information please let me know Thank you in advance

---

<div class="post-metadata">

**Author:** ![philipgriffin](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/philipgriffin/32/110462_2.png) [@philipgriffin](https://forum.ionicframework.com/u/philipgriffin)\
**Post date:** [June 9, 2017, 2:22pm UTC](https://forum.ionicframework.com/t/local-notification-issue/87473/2 "2017-06-09T14:22:23Z")

</div>

I’m having this issue too.

@techsnake did you ever find a solution?

I’m using local notifications and background mode.  
It works fine when the device is awake.

If I lock the screen but keep the screen on (still on the lock screen) it works. But once I let the screen go black it doesn’t send the notification and then randomly it will come through at some point.

These features are something so critical to a lot of applications these days yet they’re so hit and miss.

---

<div class="post-metadata">

**Author:** ![techsnake](https://avatars.discourse-cdn.com/v4/letter/t/7ab992/32.png) [@techsnake](https://forum.ionicframework.com/u/techsnake)\
**Post date:** [June 10, 2017, 2:18pm UTC](https://forum.ionicframework.com/t/local-notification-issue/87473/3 "2017-06-10T14:18:16Z")

</div>

Nope sorry i couldnt find any solution .

---

<div class="post-metadata">

**Author:** ![philipgriffin](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/philipgriffin/32/110462_2.png) [@philipgriffin](https://forum.ionicframework.com/u/philipgriffin)\
**Post date:** [June 10, 2017, 9:09pm UTC](https://forum.ionicframework.com/t/local-notification-issue/87473/4 "2017-06-10T21:09:10Z")

</div>

@techsnake

I have found a solution that worked for me it gave me both things I was looking for, a heads up notification and the notifications working when the device is locked and screen is dimmed.

It had one minor drawback in that the device doesnt light up when the notification is received but the sound plays and it works when scheduled. (EDIT: On second look this may be just my phone as it happens with all notifications from any application)

My solution was to uninstall the ionic-native plugin for local notifications and use this fork [https://github.com/DavidBriglio/cordova-plugin-local-notifications](https://github.com/DavidBriglio/cordova-plugin-local-notifications)

Add to your project:

```auto

cordova plugin add https://github.com/DavidBriglio/cordova-plugin-local-notifications

```

Then in the page you’re using local notifications:

Put this up top:  
`declare var cordova;`

then:

```auto
this.plt.ready().then(()=> {
         (<any>cordova).plugins.notification.local.schedule({
         id: 1,
         title: "Title",
         text: "Text",
         headsup: true
         at: Date.now()
       });
   });

```

---

<div class="post-metadata">

**Author:** ![techsnake](https://avatars.discourse-cdn.com/v4/letter/t/7ab992/32.png) [@techsnake](https://forum.ionicframework.com/u/techsnake)\
**Post date:** [June 11, 2017, 11:05am UTC](https://forum.ionicframework.com/t/local-notification-issue/87473/5 "2017-06-11T11:05:49Z")

</div>

i ll try it for the next project thanks for contribution

---

<div class="post-metadata">

**Author:** ![ApprenticeIonic](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@ApprenticeIonic](https://forum.ionicframework.com/u/ApprenticeIonic)\
**Post date:** [October 12, 2017, 12:54am UTC](https://forum.ionicframework.com/t/local-notification-issue/87473/6 "2017-10-12T00:54:29Z")

</div>

this is really works for you?

on different types of phones?

I doubt because the github have long time without any updates. ☹

---

<div class="post-metadata">

**Author:** ![philipgriffin](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/philipgriffin/32/110462_2.png) [@philipgriffin](https://forum.ionicframework.com/u/philipgriffin)\
**Post date:** [October 12, 2017, 10:18am UTC](https://forum.ionicframework.com/t/local-notification-issue/87473/7 "2017-10-12T10:18:25Z")

</div>

This did really work for me. Heads up notifications were working on iOS. Just not on android. The problem was that the priority attribute was missing from the ionic wrapper. This was since fixed and added in the ionic wrapper. You need to have priority set to 1 to get a heads up notification on android. I haven’t tested the ionic wrapper but I can confirm that the fork I used from the local notifications repository worked for me. I did not use the ionic wrapper.

---

<div class="post-metadata">

**Author:** ![ApprenticeIonic](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@ApprenticeIonic](https://forum.ionicframework.com/u/ApprenticeIonic)\
**Post date:** [October 13, 2017, 3:45pm UTC](https://forum.ionicframework.com/t/local-notification-issue/87473/8 "2017-10-13T15:45:56Z")

</div>

I have other question, also happen to you that notifications when were opened, were double?

I don’t identify the pattern, but sometimes opened double and sometimes not :S.

The other thing, the notification doesn’t show in exactly time, is displayed in a range within one minute, that it happen to you too?

I modified the plugin code with something that i saw in pulls requests from katzer github, and works, but sounds two times, and the third not, after two times more, and again not, is very strange.

If I dont modify this in plugin, always sounds, but not in exact time ☹ .

And i see that works in background mode in android with david briglio’s fork 🙂 Thanks!!.

However, I should try different phones. 😛
