Inevio / Gmail

0 stars 1 forks source link

If the app is closed the badge of the dock icon is not updated #12

Closed jorge9200 closed 6 years ago

jorge9200 commented 6 years ago

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)

burhan-project-manager commented 6 years ago

How? :)

jorge9200 commented 6 years ago

You have to add a new script to your static folder, and declare it on info.json like this:

Example of Cosmos app: image

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.

burhan-project-manager commented 6 years ago

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

jorge9200 commented 6 years ago

have you set it on info.json? Can you show me how?

burhan-project-manager commented 6 years ago

Yes placed in info.json

image

jorge9200 commented 6 years ago

let me test it!

jorge9200 commented 6 years ago

I can't find your service.js image

burhan-project-manager commented 6 years ago

Strange

It is within script.js

image

jorge9200 commented 6 years ago

strange, let me check again

jorge9200 commented 6 years ago

totally my fault, I forgot you have to include service into permissions like this: image

burhan-project-manager commented 6 years ago

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?

jorge9200 commented 6 years ago

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.

burhan-project-manager commented 6 years ago

@jorge9200 badge is updating now using event handlers. When app is closed, we are only updating badge, not showing banner! Is that ok?

jorge9200 commented 6 years ago

you also have to fire the banner when event is handled, in the same code area as badge update

burhan-project-manager commented 6 years ago

Banner is also fired!

jorge9200 commented 6 years ago

yes now it firing! issue fixed