Hello,
I'm trying local notification on a new blank app. But I can't have the notifications triggered on iOS (I have an iPhone 5 with iOS 9.3).
Everything's working on Android but not on iOS. First I thought it was a notification permission problem, so I started to implement the hasPermission function, but it didn't work better. So I tried to add the notification registering directly in the Objective-C code. I got the message to activate notifications for this app, but then, the notifications still doesn't work when I click on my app's buttons.
Just to summarize I simplified the code and the following one works fine on Android but on iOS, it only displays the "test permission" alert :
app.controller('NotificationController', function($scope, $cordovaLocalNotification, $ionicPlatform) {
$ionicPlatform.ready(function () {
alert('test permissions !');
window.plugin.notification.local.hasPermission(function (granted) {
alert('Permission has been granted: ' + granted);
});
....
I've having the same problem.
iPhone 5S with iOS 9.3.2.
The notification displays perfectly on Android, but nothing happens on iOS.
This code works for me with iPhone 5S with iOS 9.3.2 and Cordova 6.2
cordova.plugins.notification.local.registerPermission(function(str) {
console.log('Push Permissions:'+str);
cordova.plugins.notification.local.schedule({
id: 10,
title: "yo test in 15 minutes!",
text: "test test test",
badge: 1,
icon: 'res://drawable-mdpi-v4/icon.png',
smallIcon:'res://drawable-ldpi-v4/icon.png',
data: { yo_payload:"yo data" }
});
});
on click and on trigger events are not firing in iOS.In android working fine
On iOS, local notification is not working.
iPhone 5s, iOS 10
@julianlecalvez it is working on your ios device?
Yes it worked with @brettyboo's code. But I didn't try on iOS 10 yet ! did you ?
it didn't work on iOS 10, didn't check old iOS version.
I've just had the same issue on iOS10 used this fork to fix it:
https://github.com/acianti/cordova-plugin-local-notifications
from this thread:
https://github.com/katzer/cordova-plugin-local-notifications/issues/1096
so it worked fine?
cordova plugin add https://github.com/acianti/cordova-plugin-local-notifications
I just tested, but not working yet. :(
registerPermisson is working.
cordova.plugins.notification.local.registerPermission(function(str) {
console.log('Push Permissions:'+str);
setTimeout(function () {
cordova.plugins.notification.local.schedule({
id: 10,
title: "yo test in 15 minutes!",
text: "test test test",
badge: 1,
data: { yo_payload:"yo data" }
});
}, 1000);
});
I got
console.log('Push Permissions:'+str);
Please help me. thank you
ill try my best! :-S first thing try making the id a string instead of a integer and add a time as well using the at attribute like so:
var now = new Date ();
var testdate = new Date (now);
testdate.setMinutes(now.getMinutes() + 1);
// local notification in 1minutes time
cordova.plugins.notification.local.schedule({
id: "10",
title: "yo test in 15 minutes!",
text: "test test test",
at: testdate
badge: 1,
data: { yo_payload:"yo data" }
});
Thank you, let me know if you got success, I am sure I already tested. "new Date()" example.
also i remove the plugin then removed the iOS platform then re-added the platform and then the patched fork of plugin
At that time, plugin worked?
and make sure working plugin(you said patched) link please. thanks
Great, it worked. but worked when app is only background. do you have solution to working when app is active?
android worked fine when app is active also.
no I didn't find a solution for this as its not requirement for the app I'm working on, there's another thread on here about the IOS10 issue but i can't find it again!
iOS (generally) does not allow local notifications to fire when the app is backgrounded—this is due to the OS, not to the plugin. Search the issues though, there may be a workaround.
On Oct 6, 2016, at 4:22 AM, MobileWebPro [email protected] wrote:
Great, it worked. but worked when app is only background. do you have solution to working when app is active?
android worked fine when app is active also.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub https://github.com/katzer/cordova-plugin-local-notifications/issues/1031#issuecomment-251935002, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVytIDAajfMCYOckA3v7eh6c8vbgP8kks5qxNncgaJpZM4JFGxV.
Most helpful comment
This code works for me with iPhone 5S with iOS 9.3.2 and Cordova 6.2