0

I have an application with a AccesibilityService declared in Manifiest.xml this way:

<service android:name="com.clv.app3.NoficationService"  
            android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
      <intent-filter>
           <action android:name="android.accessibilityservice.AccessibilityService" />
      </intent-filter>
</service>

Well. I have another service, and an activity. When the application is launched, the AccesibilityService is automatically lauched. When I close the application... the AccesibilityService is still alive, and if I restart my android device, the AccesibilityService is started too, so I lose control from my application. Can I make it manual as in other services ?

Ravi
  • 34,851
  • 21
  • 122
  • 183
ChristLarsen
  • 115
  • 1
  • 1
  • 9

2 Answers2

1

When your application is closed, you can terminate the NotificationService.

i.e. start NotificationService inside onCreate() and terminate NotificationService inside onStop().

onStop()
{
...
stopService(new Intent(context,NotificationService.class));
...
}
Swayam
  • 16,294
  • 14
  • 64
  • 102
  • Hello Swayam. Thanks for your answer. I have tried to do what you say. In my application OnCreate I have now: `Intent intentN = new Intent(this, NoficationService.class); startService(intentN); bindService(intentN, mConnectionN, Context.BIND_AUTO_CREATE);` but when I run the application it causes an exception: `without permission android.permission.BIND_ACCESIBILITY_SERVICE`. I have this permission in my `manifest.xml` ... and it does not work ... any idea? – ChristLarsen Jan 09 '14 at 14:11
  • 1
    Have you followed all the steps as mentioned here ? http://stackoverflow.com/a/12336085/1393623 – Swayam Jan 11 '14 at 10:32
1

I have been working on it, and readed a lot of text about accesibilityservices.

When an application with an AccesibilityService is installed in the system, and user enable accesibility for it in the system configuration menu, the AccesibilityService is then executed and is stays binded to the system. So only the android system can start and stops this kind of services.

ChristLarsen
  • 115
  • 1
  • 1
  • 9