Answer the question
In order to leave comments, you need to log in
How to pass messages (data) to an android app?
I have an application that needs to receive data from outside. Not periodically, but as these data become available. The "data" itself is a small piece of text. In fact, something like a messenger.
The essence of the problem : I tried to create a Service (Service) that would work with websockets. Raised a test server that sends messages, everything is ok. But on exit (application close) android kills my service. And I need messages to reach in the background. And it is highly desirable that they continue to come after rebooting the device without having to launch the application every time after rebooting. Exactly how it works in messengers.
For two days I read, tried - all in vain. The more I read, the more confused I get. Now it seems to me that due to the limitations of the latest versions of Android on the operation of background services, it is only possible to do this normally through the use of Firebase Cloud Messaging (FCM). Formerly apps for mob. Devices did not write, maybe I'm missing something.
Answer the question
In order to leave comments, you need to log in
FCM (push) is the right decision. Services are in fact outdated, now it makes sense only in the foreground service.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question