Closed jorge9200 closed 6 years ago
How? :)
You have to add a new script to your static folder, and declare it on info.json like this:
Example of Cosmos app:
Then this script will be executing always on the background, there you can listen for events and update the badge of the app.
Be careful, because this script also will be executed when the app is opened. So it can be bugs of duplicated listeners on main script and service script.
We have added "service.js" in info.json but that file is not executing in background. We have placed service.js file in same location as scripts.js
have you set it on info.json? Can you show me how?
Yes placed in info.json
let me test it!
I can't find your service.js
Strange
It is within script.js
strange, let me check again
totally my fault, I forgot you have to include service into permissions like this:
Added and it is working now. But it is only triggering once when page loads. Isn't it should trigger again and again in background?
Yes, it only trigger once. You should put the event handlers there and anytime a mail is sent or received it should do the behavior you have setted.
@jorge9200 badge is updating now using event handlers. When app is closed, we are only updating badge, not showing banner! Is that ok?
you also have to fire the banner when event is handled, in the same code area as badge update
Banner is also fired!
yes now it firing! issue fixed
When the app is open and you receive a new email the badge of the dock is updated correctly but if the app is closed then it does not move
You have to use service.js (Ask how)