0

I want my app I build with Cordova and which runs on Android and ios to check my server for some data. I then want to use this data to update the badge at the phone homescreen. For this badge I use the plugin created by Katzer https://github.com/katzer/cordova-plugin-badge.

Now I believe the best way to achieve this is to generate an Ajax call to get the data from the server. Problem is that I want to do this specifically when the user is not actually using the app, preferably about once a day. Now I have found that it is possible to achieve this in the background using various plugins that create a background mode, but this is battery intensive and won't work if the user as stopped the app.

My question is what would be the best way to update my badge without the user having to open the app?

1 Answers1

0

As you said, you need to use a background service OR if you use FCM (Firebase Messaging plugin), you can set the badge number while you are sending a notification.

So the best way would be to push to the device when something happens and change the badge number at that time. Then there is no need to do any Ajax call as you can use the data that was sent with the notification.

Also welcome to S.O.

Eric
  • 9,870
  • 14
  • 66
  • 102