Example usage for android.content ContextWrapper unbindService

List of usage examples for android.content ContextWrapper unbindService

Introduction

In this page you can find the example usage for android.content ContextWrapper unbindService.

Prototype

@Override
    public void unbindService(ServiceConnection conn) 

Source Link

Usage

From source file:br.com.viniciuscr.notification2android.mediaPlayer.MusicUtils.java

public static void unbindFromService(ServiceToken token) {
    if (token == null) {
        Log.e("MusicUtils", "Trying to unbind with null token");
        return;//from ww w  .j  a  v a 2  s.c o  m
    }
    ContextWrapper cw = token.mWrappedContext;
    ServiceBinder sb = sConnectionMap.remove(cw);
    if (sb == null) {
        Log.e("MusicUtils", "Trying to unbind for unknown Context");
        return;
    }
    cw.unbindService(sb);
    if (sConnectionMap.isEmpty()) {
        // presumably there is nobody interested in the service at this point,
        // so don't hang on to the ServiceConnection
        sService = null;
    }
}

From source file:com.andrew.apollo.utils.MusicUtils.java

/**
 * @param token The {@link ServiceToken} to unbind from
 *///from ww w . j  a v  a  2s  . com
public static void unbindFromService(final ServiceToken token) {
    if (token == null) {
        return;
    }
    final ContextWrapper mContextWrapper = token.mWrappedContext;
    final ServiceBinder mBinder = mConnectionMap.remove(mContextWrapper);
    if (mBinder == null) {
        return;
    }
    mContextWrapper.unbindService(mBinder);
    if (mConnectionMap.isEmpty()) {
        mService = null;
    }
}

From source file:jp.mixi.android.sdk.MixiContainerImpl.java

@Override
public void close(ContextWrapper context) {
    if (mRemoteAuth != null) {
        context.unbindService(mServiceConnection);
        mRemoteAuth = null;/*from   w  w  w  .  j  a  v  a  2  s.  com*/
    }
}