views:

92

answers:

1

Hello, I would like to make a service that runs in the background and monitors the quality. I have thought of a separate service that exposes an aidl interface to an activity, the aidl would have some monitor related functions that an activity can call. To give an example of how my service should work think of the ebuddy application that runs in the background and waits for incoming calls (I believe this is done by a service).

  1. Is this a correct approuch to my problem?
  2. I am currently able to create my service and use the aidl interface but when i close the activity(when I press the back button) the service is destroyed too! How to avoid that?
  3. I would like to make a persistent notification much like ebuddy, how to do it? I have tried with notification manager but no luck, I have only managed to add at the notification section.
A: 

Ok so to make the notification you simply have to do

 mNotification = new Notification( icon, text, when );
 mNotification.flags |= Notification.FLAG_ONGOING_EVENT;

and notify using notification manager.

If someone needs to run something on the background (not a background thread) then you have to extend service class,you have to bind to the service and get a stub, you can then call methods that the stub exposes through it's aidl file. for more information you can check out the Remote service example that comes with the SDK, its located in:/src/com.example.android.apis/app

regards maxsap.

maxsap