Android Service - Cant seem to find an example -


I have scratched the web, I can not know how to actually serve the Android I found so many examples. How to make a basic one, but none of the examples show how to call service, and something to do with service

For example, I would like to run a service Which requests a TCP text message when the server Will be sent on I can make the service, and run it, but what activity do I have that call which sends a string in the service method which sends TCP messages?

It seems it should be somewhat easy, but I do not understand how to do this, for example. Maybe I can not understand what service should be used for? I definitely want to run it for a long time, no guai is required, and to send TCP message to "service" requests .... we ...

< Div class = "post -text" itemprop = "text">

I can create a service, and have it run, but how do I have that activity that creates the call that the method of service Send a message to TCP?

Use the local binding pattern To get some data obtained by a service based on a location change (weather forecast), an activity is linked to a service, in an activity a user To inform about the changes in the identi.ca timeline, a listener is connected to a service to register the object.

Or, use a IntentService and startService () to send a command to process by IntentService . In, I apply a IntentService , which executes a beanschal script given by the caller. In, I apply an activity that sends the Beanshell script to IntentService . This combination of example is designed to use this technique in all techniques, but the approach works fine in the same application.

I definitely want to run it for a long time

.


Comments