A
A
Alex Raven2016-02-29 22:13:32
JavaScript
Alex Raven, 2016-02-29 22:13:32

Cordova: how to make a background service?

I wrote a simple client application that authorizes a user on the site and displays messages addressed to this user. For this, the simplest self-written API is used, which returns information in JSON format. It is stored locally in sqlite so that you can log in and read offline.
Now we need to make sure that the application receives messages in the background, even when it is not explicitly running. When you receive new messages, you need to display something like "XX new messages" in the notification area. And also display the number of new messages on the application icon.
How to do it?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton Ulanov, 2016-02-29
@antonsr98

you need a background service, now I'm looking for a solution to this problem myself. but i need gps

_
_ _, 2016-03-01
@AMar4enko

You need push notifications.
Search the internet for the cordova push plugin.
Phonegap push plugin is the same

A
Alex Raven, 2016-03-01
@alexraven

By the way, I tried this: https://github.com/katzer/cordova-plugin-backgroun...
It's not that the background service (background service) - I read a lot of information, they write that it's impossible to create such a pure JavaScript, but it is possible to write the background part in Java.
The Cordova Background Plug-in simply prevents the application from sleeping when it is not active. Well, accordingly, it is not unloaded to free memory. I don't know exactly what is responsible for this in Android - the garbage collector?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question