Closed aerlijman closed 11 years ago
Hi there :)
Sure... at the bottom of the readme.md we include sample code like this;
Set application badge value
localNotification.setApplicationBadge(int value);
Get the application badge value
localNotification.getApplicationBadge(getSuccessFunction);
Scenario example;
// Sets the badge to be 0 if not already 0.
localNotification.getApplicationBadge( function(badgeValue) {
if ( badgeValue != 0 ) {
localNotification.setApplicationBadge(0);
}
} );
Excellent. That helped me a lot. Now I am dealing with the action when you click in the notification after you get it. It looks like the callback is not enabled. Are you using the callback? Is it working? I have trying sending a javascript function in the action param but it does not work. Ideas?
Thx again.
Hi, Did you follow step 3? There is no callback for clicking on a notification. It is event based, you must add an eventListener to catch the emitted 'receivedLocalNotification' event. Have you tried adding step 3 code into the index.html in the example project?
Step 3 is working perfect. I have no problem there. I need something like that but when I click on the notification that is displayed in the Notification Center. For example... I get 4 notifications.. and I want click them one by one. Thx again.
@aerlijman I'm not sure I understand the problem -- it actually sounds like you've reported 2 separate issues as a single issue. If the badging issue has been resolved, I think this issue can be closed.
For the separate issue (i.e. when you get 4 notifications and you want to click them one by one), I think there should not be anything preventing you from clicking them any or each of them. When you click on notification in iOS, the app will be launched or will resume running from the background. You can verify this behavior by experimenting with the example app. When the app is launched/resumed the 'receivedLocalNotification' event will be trigger. If you've setup to listen for the event, you will receive the event with an 'active' flag and a 'notificationId'. You can use the 'notificationId' to distinguish between which notification triggered a specific event.
Thx!
Thank you very much for your work. I could make it work very easily with you tutorial. However, I do not understand how to get and increase the badge counter. Can you send me an example? thx in advance Ariel