Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 10 notification problem #1096

Closed
acianti opened this issue Sep 14, 2016 · 126 comments
Closed

iOS 10 notification problem #1096

acianti opened this issue Sep 14, 2016 · 126 comments

Comments

@acianti
Copy link

acianti commented Sep 14, 2016

Dear @katzer,
we are using your plugin in hybrid app for a very important costumer and we have a problem with notification in iOS 10 GM using version 0.8.4.
The issues is not display the notification in iPhone devices.
Waiting for your new release that patch this issue I modified then plugin, following the indication present in the issues #1034.
I've created a new fork here: https://github.com/acianti/cordova-plugin-local-notifications, please refer to this to find details of modification done.
Can you please implement as soon as possible the above fix in the new version of plugin. Can you also please inform about possible date in which new plugin would be avaible?
Many thanks in advance for your support!
Best regards,
Andrea

@sumedh-plenarea
Copy link

sumedh-plenarea commented Sep 14, 2016

Even I am facing the same issue. I am using Ionic and notifications are not getting scheduled for iOS 10. Do i need to use the new fork temporarily https://github.com/acianti/cordova-plugin-local-notification.?

@gaurangpatel
Copy link

I too facing same issue, working on ionic App with local notification.

any workaround to use deprecated UILocation or update in the plugin itself?

@spk0611
Copy link
Contributor

spk0611 commented Sep 15, 2016

@sumedh908 @gaurangpatel I have fixed the issue on iOS 10 and created the PR - #1093
Please have a look and let me know if that works.

@gaurangpatel
Copy link

gaurangpatel commented Sep 20, 2016

Thanks @spk0611 ,

I changed the file APPLocalNotification.h and added framework 'UserNotifications', I am getting notification when exit from region but not at enter region.

Do I need to make any other changes besides these two?

May be issues is related to delay or execution time but not sure.

@JLNNN
Copy link

JLNNN commented Sep 21, 2016

👍 +1

@lucbonnin
Copy link

@katzer any chance to have a clean release for ios 10 ?
As a ionic user i'm really blocked outthere :(

@smuaq
Copy link

smuaq commented Sep 28, 2016

Any updates on release on IOS 10?

@timelight
Copy link

timelight commented Sep 30, 2016

I could find the fix in the ios branch and it seems to work well.

cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications#ios10

@anuradhawick
Copy link

@timelight does this work well on android as well?

@sKuD51
Copy link

sKuD51 commented Oct 3, 2016

Hi,

I've updating my plugin but it doesn't work. I do this :
$timeout(function(){ cordova.plugins.notification.local.schedule({ title: "New Message", message: "Hi, are you ready? We are waiting." }); alert('timeout'); },5000);
I send just one notification after 5s app started.
What's wrong ? I'm using #ios10 update.
Thx !!!

@sKuD51
Copy link

sKuD51 commented Oct 4, 2016

Sorry but it doesn't work for me. I don't know why.
Here, my plugins list :
com.unarin.cordova.beacon 3.4.0 "Proximity Beacon Plugin"
cordova-plugin-app-event 1.2.0 "Application Events"
cordova-plugin-compat 1.0.0 "Compat"
cordova-plugin-device 1.1.3 "Device"
cordova-plugin-whitelist 1.3.0 "Whitelist"
de.appplant.cordova.plugin.local-notification 0.8.4.1 "LocalNotification" -> downloaded from https://github.com/Telerik-Verified-Plugins/LocalNotification.git
My app authorize Notification and I just send a test, there is nothing else.
Any idea ?
Thanks a lot .

@sKuD51
Copy link

sKuD51 commented Oct 4, 2016

@timelight it works for you ? do you have any example ? Thx.

@ddennis
Copy link

ddennis commented Oct 4, 2016

Hi i tried the version reference above by EddyVerbruggen, which hasent been merged yet. It works in my ionic app.

@sKuD51
Copy link

sKuD51 commented Oct 4, 2016

@ddennis do you have a sample code ? I can find the solution, it works on iOS9 but not on iOS10. It's incredible !! Thx

@ddennis
Copy link

ddennis commented Oct 4, 2016

@sKuD51 I removed the current version with:

cordova plugin rm add de.appplant.cordova.plugin.local-notification

And install the telerik version from github:

cordova plugin add https://github.com/Telerik-Verified-Plugins/LocalNotification

@sKuD51
Copy link

sKuD51 commented Oct 4, 2016

@ddennis that's I've did :-(
I'm using cordova 6.1.1, cordova ios 4.1.2 and xcode 8.0

@ddennis
Copy link

ddennis commented Oct 4, 2016

@sKuD51 maybe the problem is in your client code

@sKuD51
Copy link

sKuD51 commented Oct 4, 2016

@ddennis Maybe, but I can understand why it works fine on iOS 9 and not on iOS10. I've the prompt windows and I click Allow, but that's all, I've no notification.
Thx.

@Tawpie
Copy link

Tawpie commented Oct 4, 2016

@sKuD51: be sure to include a string id… id: ‘Testing’ or something similar as well as specify the you want the reminder to fire (the ‘at:’ option). Your code sample doesn’t reflect correct use of the API for the plugin. Here’s where you can find more information: https://github.com/katzer/cordova-plugin-local-notifications/wiki/04.-Scheduling https://github.com/katzer/cordova-plugin-local-notifications/wiki/04.-Scheduling

On Oct 3, 2016, at 8:36 AM, sKuD51 notifications@github.com wrote:

Hi,

I've updating my plugin but it doesn't work. I do this :
$timeout(function(){
cordova.plugins.notification.local.schedule({
title: "New Message",
message: "Hi, are you ready? We are waiting."
});
alert('timeout');
},5000);
I send just one notification after 5s app started.
What's wrong ? I'm using #ios10 update.
Thx !!!


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub #1096 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AHVytHsWvfvBr76fRmK8YT_F3FN47V67ks5qwSDlgaJpZM4J8ec0.

@sKuD51
Copy link

sKuD51 commented Oct 4, 2016

So,
I create a new simple project app : cordova create test2 com.test1.app test2 with cordova 6.1.1 and just add plugin : cordova plugin add https://github.com/acianti/cordova-plugin-local-notifications
Next, I add iOS platform : cordova platform add ios
Here are my logs :
`Adding ios project...
iOS project created with cordova-ios@4.1.1
Installing "de.appplant.cordova.plugin.local-notification" for ios
Fetching plugin "cordova-plugin-device" via npm
Installing "cordova-plugin-device" for ios
Fetching plugin "cordova-plugin-app-event" via npm
Installing "cordova-plugin-app-event" for ios

    Your support is needed. If you use the local-notification plugin please support us in order to ensure further development.
    https://github.com/katzer/cordova-plugin-local-notifications#supporting

    Thank you!

Discovered plugin "cordova-plugin-whitelist" in config.xml. Installing to the project
Fetching plugin "cordova-plugin-whitelist@1" via npm
Installing "cordova-plugin-whitelist" for iosFinally, I just add a simple notification in index.js in deviceready event : onDeviceReady: function() {
alert('ready to go');
cordova.plugins.notification.local.schedule({
id: 1,
text: "Single Notification",
sound: isAndroid ? 'file://sound.mp3' : 'file://beep.caf'
});
app.receivedEvent('deviceready');
},`
And I run : cordova run ios
I see alert, prompt window, I allow notification, but there is no notification in list.
How can I do more simple like this ?

@Tawpie
Copy link

Tawpie commented Oct 4, 2016

you still need to tell it when to fire the notification (the at: option)… like at: new Date(new Date().getTime() + 10000)
And the id: MUST be a string, not an int.

On Oct 4, 2016, at 7:51 AM, sKuD51 notifications@github.com wrote:

So,
I create a new simple project app : cordova create test2 com.test1.app test2 with cordova 6.1.1 and just add plugin : cordova plugin add https://github.com/acianti/cordova-plugin-local-notifications https://github.com/acianti/cordova-plugin-local-notifications
Next, I add iOS platform : cordova platform add ios
Here are my logs :
`Adding ios project...
iOS project created with cordova-ios@4.1.1
Installing "de.appplant.cordova.plugin.local-notification" for ios
Fetching plugin "cordova-plugin-device" via npm
Installing "cordova-plugin-device" for ios
Fetching plugin "cordova-plugin-app-event" via npm
Installing "cordova-plugin-app-event" for ios

Your support is needed. If you use the local-notification plugin please support us in order to ensure further development.
https://github.com/katzer/cordova-plugin-local-notifications#supporting

Thank you!

Discovered plugin "cordova-plugin-whitelist" in config.xml. Installing to the project
Fetching plugin "cordova-plugin-whitelist@1" via npm
Installing "cordova-plugin-whitelist" for ios
Finally, I just add a simple notification in index.js in deviceready event :
onDeviceReady: function() {
alert('ready to go');
cordova.plugins.notification.local.schedule({
id: 1,
text: "Single Notification",
sound: isAndroid ? 'file://sound.mp3' : 'file://beep.caf'
});
app.receivedEvent('deviceready');
},`
And I run : cordova run ios
I see alert, prompt window, I allow notification, but there is no notification in list.
How can I do more simple like this ?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub #1096 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AHVytMGDOkEAt6wMQlYY2Sy09JRBMkAhks5qwmgNgaJpZM4J8ec0.

@sKuD51
Copy link

sKuD51 commented Oct 4, 2016

@Tawpie I never used "at option", because I send notification on click (for example). And I've tried with String id => nothing .
I'm going crazy !!!

@Tawpie
Copy link

Tawpie commented Oct 4, 2016

@sKuD51 I think that you’ll still need to specify at: because if you don’t provide a fire date/time the phone does not know when to trigger the notification.

Be sure to set the fire date far enough in the future so that the fire date doesn’t happen before the software has a chance to complete the actual scheduling with the phone’s operating system. Notifications scheduled in the past won’t fire. Scheduling a notification to fire a second or two into the future should be fairly immediate for the user.

Curious though, if you’re wanting to alert the user on-click, is it necessary to use the local notification mechanism?

On Oct 4, 2016, at 8:12 AM, sKuD51 notifications@github.com wrote:

@Tawpie https://github.com/Tawpie I never used "at option", because I send notification on click (for example). And I've tried with String id => nothing .
I'm going crazy !!!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #1096 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AHVytK856HNivcRdxWWRKjvys50hNv8Sks5qwmz6gaJpZM4J8ec0.

@sKuD51
Copy link

sKuD51 commented Oct 4, 2016

@Tawpie In my app, I'm using notification with ibeacon plugin. When app is in background mode and user enter in a ibeacon region, app send a notification with ibeacon's enter message. This method worked very fine in iOS 9, 8, 7 ... and I repeat, I never used 'at' option, because I send notification in 'live' .
So, I don't understand the problem.
I thank you for yours advices.

@Tawpie
Copy link

Tawpie commented Oct 4, 2016

I understand—that’s an entirely different use case than what I use. But if you can stand a delay of a second or two, you could try setting an at: time a couple seconds into the future.

I’m not sure of all the changes Apple made in iOS10, but something they did broke the way this plugin worked. Which tells me that in the OS something has changed, so what worked on iOS 7-9 may now be broken.

Good luck!

On Oct 4, 2016, at 8:46 AM, sKuD51 notifications@github.com wrote:

@Tawpie https://github.com/Tawpie In my app, I'm using notification with ibeacon plugin. When app is in background mode and user enter in a ibeacon region, app send a notification with ibeacon's enter message. This method worked very fine in iOS 9, 8, 7 ... and I repeat, I never used 'at' option, because I send notification in 'live' .
So, I don't understand the problem.
I thank you for yours advices.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #1096 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AHVytAJrOuILzAFI_wHuoUMZQStGHRoXks5qwnTxgaJpZM4J8ec0.

@sKuD51
Copy link

sKuD51 commented Oct 4, 2016

@Tawpie Thanks. iOS10 is really a p... of ch.. there are so many changes and some plugins doesn't work.

@lucbonnin
Copy link

FYI, the notification is working on the ios simulator (only in background mode, so get back to device home) but not on a real device :(
It is driving me crazy !


 cordova.plugins.notification.local.schedule({
            id: 'ID-'+Date.now(),
            at: new Date(new Date().getTime() + 10000),// now + 1s
            title: 'TEST',
            text: 'TEST content',
            badge: 666
        });

@sKuD51
Copy link

sKuD51 commented Oct 6, 2016

@lucbonnin I confirmed, notification is only displayed when app is in background, and I tested my app on real device, that's run.
And I confirm again, in my app, I use this plugin like this :
cordova.plugins.notification.local.schedule({ id : i, title : "My title", text : "My message", badge : i });
Where i is an integer that I increment if app displays more than one notification.
In other way, If found this example : https://swifting.io/blog/2016/08/22/23-notifications-in-ios-10/ but I don't know if we could adapt-it in this plugin. @katzer ?

@gurix
Copy link

gurix commented Jan 5, 2017

I am using 10.2 (14C92). On the Simulator 10.2(15C89) I can hear a sound after 5 seconds, but nothing more.

@gurix
Copy link

gurix commented Jan 5, 2017

Hi all. I found the issue. It seems that it is necessary to set the text attribute. I used only the title in the past.
This is working...

$cordovaLocalNotification.schedule({
  id: 666,
   title: 'Test',
   text: "Diese Mitteilung erscheint als Test nach 5 Sekunden.",
   at: _5_sec_from_now
});

This is no longer working...

$cordovaLocalNotification.schedule({
  id: 666,
  title: 'Test',
   at: _5_sec_from_now
});

@rwillett
Copy link
Collaborator

rwillett commented Jan 5, 2017

Would be good to know if that fixes the problem.

I'm just doing a build for the simiulator for 10.2.1 to try this out. We use the text: attribute anyway so we may never have noticed the issue.

Rob

@rwillett
Copy link
Collaborator

rwillett commented Jan 5, 2017

We've just tested this on 10.2 (14C89) and the same code we already use works for us.

We made no changes whatsoever for 10.2 (14C89), though we did already have a test attribute.

Rob

@suryakand
Copy link

Yes, I can confirm that this branch works on iOS 10.x
ionic plugin add https://github.com/katzer/cordova-plugin-local-notifications#ios10

Here is my code for ionic2:

  1. Import "LocalNotifications"
    import { LocalNotifications } from 'ionic-native';

  2. Setup delayed notification after 5 sec. (You can execute below code on a button click and send your app to background and notification will be triggered after 5 sec.)

    LocalNotifications.schedule({
    id: 1,
    title: "Test Title",
    text: "Delayed Notification",
    at: new Date(new Date().getTime() + (5 * 1000))
    });

@ammichael
Copy link

ammichael commented Jan 9, 2017

Well, I've started asking whether the problem was the plugin or even my phone. Maybe something corrupted or whatever.. But I've tried in simulator and I've got the same behavior:

I had similar code to test the notification as you, @suryakand, and the notification is triggered just for the first time. So the app asks for permission, I grant it, receive notification. When I reopen the app.. Nothing.

Dude, this is so frustrating!

@rwillett
Copy link
Collaborator

rwillett commented Jan 9, 2017

@ammichael

I think this thread is getting too confusing with too many people involved with too many different issues. I'd suggest you start a new clean thread with exactly what the problem is with as much information as possible. I wouldn't link to this thread but put all the information in the new issue and work from there.

I've tried to follow whats going on in this thread and have now given up and will no longer contribute to this thread as its so difficult to trace whats happening.

Rob

@faisalalfareza
Copy link

Try this https://forum.ionicframework.com/t/ios-10-strange-problem/63916/6
**

Notifications work in iOS 10

** , after and later :)

@ammichael
Copy link

@faisalalfareza for a moment it gave me hope ☹️

When I activated it in my xcode, I really though that maybe it was gonna be just that hahhaha

Well, nope. It behaves just like I mentioned in my op. Notifications fires just the first time the app opens, when the permissions are asked. I'm gonna run some more tests today and I'll try and find more clues of what is happening.

@billycomic
Copy link

@faisalalfareza that thread is centered around push notifications. This thread is centered around local notifications. They are actually two different sets of functionality and handled differently. Enabling push notifications through xcode has no affect on local notifications.

@ammichael
Copy link

@billycomic Hey, how have you handled the 64 notifications limit? I think my case is somewhat like yours, where users don't need/always return to the app.

I'm trying to schedule 480 notification, but I can't hahaha

@billycomic
Copy link

@ammichael Unfortunately, in my case, there is no work around. The 64 notification limit (and split that for each notification) makes it unusable in my use case. I had to make a change in behavior and provide a different code path for iOS only to use the Calendar Cordova Plugin and then I'm able to store repeaters and it actually adds some nice controls from a user standpoint.

I love the local notifications plugin, but unfortunately, iOS has cracked down on how they are used. Hope that gives you some direction.

@ammichael
Copy link

@billycomic That is really, really bad. If I split the notifications by the limit it would give me 4 days of notifications; far from being enough in my case.

I've taken a look at Calendar Plugin, but that won't be useful in my case.

Not sure what to do, to be honest ☹️

@RainierMallol
Copy link

I'm having troubles getting the plugin to work in iOS. I've installed the iOS10 branch, but the notifications don't appear on iOS10. Any recommendations?

@rwillett
Copy link
Collaborator

@RainierMallol

Please do not hijack threads. If you have a problem raise a new issue using the template in #1188 with code.

@pooja-shah
Copy link

I am able to send local notification , but issue is its not showing in notification center.Its just come and disappear. Any solution for this?

@testingfhcp
Copy link

Hi all
Now i am using https://github.com/katzer/cordova-plugin-local-notifications#ios10 and it works fine on simulator, i get notification when the app is running in background.
However, on the real device, i cannot receive notification in background. The notification arrive when i open the app.
Anyone have idea?
Thanks!

@rwillett
Copy link
Collaborator

@testingfhcp

Don't hijack threads. Raise a new issue using #1188.

@auryn31
Copy link

auryn31 commented May 21, 2017

Hey Guys,
i do not get the notification work on ios 10
i use the plugin @testingfhcp recommended, (i think it does fire the notification in objective c) but i do not get any notification in my notificationcenter
did anyone can help me? :-(
here is my code to test the local notification
maybe the issue is there?

var now = new Date ();
var testdate = new Date (now);
testdate.setMinutes(now.getMinutes() + 1);
if (this.localNotifications.hasPermission()) {
this.localNotifications.schedule({
id: 4,
title: 'YEHA!',
text: 'Successfully sent a notification!',
at: testdate,
every: "second",
sound: null
});
this.notificationTest = "tried to trigger notification!";
} else {
let alert = this.alertCtrl.create({
title: 'Permissons',
subTitle: 'You do not have permission to send notification',
buttons: ['OK']
});
alert.present();
}

@Tawpie
Copy link

Tawpie commented May 21, 2017

Try without "every". That option has known problems. And make sure you have the at time set into the future enough that the OS can finish secheduling and you have a chance to quit the app. As you know, by default iOS does not fire local notifications when your app is in the foreground.

@auryn31
Copy link

auryn31 commented May 21, 2017

@Tawpie thank you so much :-)
i tried so much parameter during the original plugin and forgot to remove this one from this branch :-D
you are my rescue, it does work
thanks a lot
i think this parameter does make trouble because it is not a standard feature of ios

@jd0048
Copy link

jd0048 commented May 25, 2017

when application is in background mode ios 10 local notification not working any help?

@testingfhcp
Copy link

testingfhcp commented May 25, 2017

I am new to ionic and mobile app, but for you guys reference.

i am using https://github.com/katzer/cordova-plugin-local-notifications#ios10 with below code
LocalNotifications.schedule({
id: 1,
title: "",
text: "",
at: new Date(new Date().getTime() + (1 * 1000))
});

it works fine on ionic 2 with ios10.3.1 (14E304)

@rwillett
Copy link
Collaborator

@jd0048

Don't hijack other peoples issues. Raise a new one.

@katzer
Copy link
Owner

katzer commented Nov 1, 2017

Please use 0.9-beta for iOS 10 and above. Thanks

@piotx
Copy link

piotx commented May 14, 2018

Maybe this is a dump question. Is it possible to use 0.8 and 0.9-beta in the same app to support ios10+ and ios < 10? or what is the best way to support both older and newer ios versions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests