Question

I'm making an app in which i want a process always run in background e.g in facebook we got a notification and it will notify in our app. Kindly text.

Was it helpful?

Solution

Try Services and BroadcastReceiver to do this.

OTHER TIPS

guess you need to explain the function you want in a detailed way.

Usually we will use a Service or a Intent Service to do what you mentioned. If you want to detect a change in your application or the phone, you may register a broadcast receiver or a Content observer in the service depends on the function and effect you want. But bare in mind that, service do not have UI so you should avoid to interact with users while using Services.

From my understanding, service can do most of the tasks you want. One example is play music. You can run a service in foreground if you want to ensure that the services is harder to be killed by the system when memory is low.

Intent service is used to handle asynchronous requests (expressed as Intents) on demand one followed by another. One good example is downloading a file

For Content observer, you will observe a content and the observer will react to if when there is any change from the "OnChange" method.

For broadcast receiver, usually we will use it to observe something happen, for example, screen unlocked, boot completed, sms received.

It really depends on your needs in order to decide what kind of services you want. Please explain in details in order to get more information.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top