You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
implement Context.stopService()
This commit is contained in:
@@ -553,7 +553,15 @@ public class Context extends Object {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean stopService(Intent intent) {return false;}
|
||||
public boolean stopService(Intent intent) throws ClassNotFoundException {
|
||||
Class<? extends Service> cls = Class.forName(intent.getComponent().getClassName()).asSubclass(Service.class);
|
||||
Service service = runningServices.remove(cls);
|
||||
if (service != null) {
|
||||
service.onDestroy();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void unbindService(ServiceConnection serviceConnection) {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user