Java Code Examples for android.app.Service#onUnbind()

The following examples show how to use android.app.Service#onUnbind() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServcesManager.java    From letv with Apache License 2.0 5 votes vote down vote up
private boolean handleOnUnbindOne(Intent intent) throws Exception {
    ServiceInfo info = ApkManager.getInstance().resolveServiceInfo(intent, 0);
    if (info == null) {
        return false;
    }
    Service service = (Service) this.mNameService.get(info.name);
    if (service == null) {
        return false;
    }
    intent.setExtrasClassLoader(getClassLoader(info.applicationInfo));
    return service.onUnbind(intent);
}
 
Example 2
Source File: ServcesManager.java    From DroidPlugin with GNU Lesser General Public License v3.0 5 votes vote down vote up
private boolean handleOnUnbindOne(Intent intent) throws Exception {
    ServiceInfo info = PluginManager.getInstance().resolveServiceInfo(intent, 0);
    if (info != null) {
        Service service = mNameService.get(info.name);
        if (service != null) {
            ClassLoader classLoader = getClassLoader(info.applicationInfo);
            intent.setExtrasClassLoader(classLoader);
            return service.onUnbind(intent);
        }
    }
    return false;
}
 
Example 3
Source File: LocalAidlServices.java    From deagle with Apache License 2.0 5 votes vote down vote up
private static void unbindService(final Service service, final Intent intent) {
	if (service instanceof AidlService)
		((AidlService) service).closeBinder();
	else try {
		final boolean rebind = service.onUnbind(intent);	// TODO: Support rebind if true is returned.
		if (rebind) throw new UnsupportedOperationException("Sorry, onRebind() is not yet supported.");
	} catch (final RuntimeException e) {
		Log.e(TAG, "Error unbinding " + service, e);
	}
}