Example usage for android.app Activity unbindService

List of usage examples for android.app Activity unbindService

Introduction

In this page you can find the example usage for android.app Activity unbindService.

Prototype

@Override
    public void unbindService(ServiceConnection conn) 

Source Link

Usage

From source file:com.elkriefy.android.apps.chubbytabby.CustomTabActivityHelper.java

/**
 * Unbinds the Activity from the Custom Tabs Service
 *
 * @param activity the activity that is connected to the service
 *///from  w  w  w . ja v  a 2  s  .  co m
public void unbindCustomTabsService(Activity activity) {
    if (mConnection == null)
        return;
    activity.unbindService(mConnection);
    mClient = null;
    mCustomTabsSession = null;
}

From source file:org.deviceconnect.android.manager.setting.BaseSettingFragment.java

private synchronized void unbindManager() {
    if (!isManagerBonded()) {
        return;/*from w  ww .j  av  a2s .  co  m*/
    }
    Activity activity = getActivity();
    if (activity != null) {
        beforeManagerDisconnected();
        activity.unbindService(mServiceConnection);
        mDConnectService = null;
    }
}

From source file:com.microsoft.azure.engagement.utils.CustomTabActivityHelper.java

/**
 * Unbinds the Activity from the Custom Tabs Service.
 *
 * @param activity the activity that is connected to the service.
 *//*from   ww  w  . j ava2 s .com*/
public final void unbindCustomTabsService(Activity activity) {
    if (connection == null) {
        return;
    }
    activity.unbindService(connection);
    client = null;
    customTabsSession = null;
    connection = null;
}

From source file:me.tassoevan.cordova.BackgroundPlugin.java

private void stopService() {
    Activity context = cordova.getActivity();

    Intent intent = new Intent(context, ForegroundService.class);

    if (isBind) {
        context.unbindService(connection);
    }//from  w  w w . j a  v a2 s.c  o  m

    context.stopService(intent);

    isBind = false;
}

From source file:net.texh.cordovapluginstepcounter.CordovaStepCounter.java

@Override
public void onDestroy() {
    if (bound) {/*from  w  ww.  j  a va 2s.c  o m*/
        Activity activity = this.cordova.getActivity();
        activity.unbindService(mConnection);
    }
    super.onDestroy();
}

From source file:nl.eduvpn.app.service.VPNService.java

/**
 * Call this when the activity is being destroyed.
 * This does not shut down the VPN connection, only removes the listeners from it. The listeners will be reattached
 * on the next startup.//  www . ja v  a  2s.  c  o  m
 *
 * @param activity The activity being destroyed.
 */
public void onDestroy(@NonNull Activity activity) {
    activity.unbindService(_serviceConnection);
    VpnStatus.removeStateListener(this);
}

From source file:de.appplant.cordova.plugin.background.BackgroundMode.java

/**
 * Bind the activity to a background service and put them into foreground
 * state./*w w w .j  a  v  a 2  s  .co  m*/
 */
private void stopService() {
    Activity context = cordova.getActivity();

    Intent intent = new Intent(context, ForegroundService.class);

    if (!isBind)
        return;

    fireEvent(Event.DEACTIVATE, null);

    context.unbindService(connection);
    context.stopService(intent);

    isBind = false;
}

From source file:com.SmartDial.BackgroundMode.java

/**
 * Bind the activity to a background service and put them into foreground
 * state.//from w w w  . j  a  v  a 2  s.  c  o  m
 */
private void stopService() {
    Activity context = this.cordova.getActivity();

    Intent intent = new Intent(context, ForegroundService.class);

    if (!isBind)
        return;

    fireEvent(Event.DEACTIVATE, null);

    context.unbindService(connection);
    context.stopService(intent);

    isBind = false;
}

From source file:com.example.scandevice.ScanDevice.java

/**
 * Bind the activity to a background service and put them into foreground
 * state.//from ww w  . j a  v  a 2  s  . c  om
 */
private void stopService() {
    Activity context = cordova.getActivity();

    Intent wifiIntent = new Intent(context, WifiScanService.class);
    Intent bluetooth = new Intent(context, BluetoothScanService.class);

    if (!isBind)
        return;
    context.unbindService(connection);
    context.stopService(wifiIntent);
    context.unbindService(connection2);
    context.stopService(bluetooth);
    isBind = false;
}

From source file:uk.org.openseizuredetector.OsdUtil.java

/**
 * unbind an activity from server//  w w  w. j a  v a 2s .  c om
 */
public void unbindFromServer(Activity activity, SdServiceConnection sdServiceConnection) {
    // unbind this activity from the service if it is bound.
    if (sdServiceConnection.mBound) {
        Log.v(TAG, "unbindFromServer() - unbinding");
        writeToSysLogFile("unbindFromServer() - unbinding");
        try {
            activity.unbindService(sdServiceConnection);
            sdServiceConnection.mBound = false;
        } catch (Exception ex) {
            Log.e(TAG, "unbindFromServer() - error unbinding service - " + ex.toString());
            writeToSysLogFile("unbindFromServer() - error unbinding service - " + ex.toString());
        }
    } else {
        Log.v(TAG, "unbindFromServer() - not bound to server - ignoring");
        writeToSysLogFile("unbindFromServer() - not bound to server - ignoring");

    }
}