Example usage for android.content Context stopService

List of usage examples for android.content Context stopService

Introduction

In this page you can find the example usage for android.content Context stopService.

Prototype

public abstract boolean stopService(Intent service);

Source Link

Document

Request that a given application service be stopped.

Usage

From source file:cc.softwarefactory.lokki.android.services.DataService.java

public static void stop(Context context) {

    Log.e(TAG, "stop Service called");
    context.stopService(new Intent(context, DataService.class));
}

From source file:org.mozilla.focus.session.SessionNotificationService.java

static void stop(Context context) {
    final Intent intent = new Intent(context, SessionNotificationService.class);

    context.stopService(intent);
}

From source file:com.miguelbcr.io.rx_gps_service.lib.RxGpsService.java

public static void stopService(Context context) {
    context.stopService(new Intent(context, RxGpsService.class));
}

From source file:Main.java

/**
 * stop the running service./*w  w  w .  j  a va2s .  c  om*/
 */
public static boolean stopRunningService(Context context, String className) {
    Intent serviceIntent = null;
    boolean result = false;
    try {
        serviceIntent = new Intent(context, Class.forName(className));
        if (serviceIntent != null) {
            result = context.stopService(serviceIntent);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return result;
}

From source file:cc.softwarefactory.lokki.android.services.LocationService.java

public static void stop(Context context) {

    Log.e(TAG, "stop Service called");
    context.stopService(new Intent(context, LocationService.class));
}

From source file:Main.java

public static boolean stopRunningService(Context ctx, String className) {
    Intent intent_service = null;/*from w w w  . j  a  va 2s .  c  om*/
    boolean ret = false;
    try {
        intent_service = new Intent(ctx, Class.forName(className));
    } catch (Exception e) {
    }
    if (intent_service != null) {
        ret = ctx.stopService(intent_service);
    }
    return ret;
}

From source file:com.prey.beta.actions.PreyBetaController.java

public static void startPrey(Context ctx, String cmd) {
    PreyConfig config = PreyConfig.getPreyConfig(ctx);
    if (config.isThisDeviceAlreadyRegisteredWithPrey()) {
        // Cancelling the notification of the SMS that started Prey

        PreyConfig.getPreyConfig(ctx).setCanAccessCamara(PreyPermission.canAccessCamera(ctx));
        PreyConfig.getPreyConfig(ctx).setCanAccessCoarseLocation(PreyPermission.canAccessCoarseLocation(ctx));
        PreyConfig.getPreyConfig(ctx).setCanAccessFineLocation(PreyPermission.canAccessFineLocation(ctx));
        PreyConfig.getPreyConfig(ctx).setCanAccessReadPhoneState(PreyPermission.canAccessReadPhoneState(ctx));

        config.setRun(true);//from www . ja  v  a  2s.  c  om
        final Context context = ctx;
        final String command = cmd;
        new Thread(new Runnable() {

            public void run() {
                //First need to stop a previous running instance.
                context.stopService(new Intent(context, PreyBetaRunnerService.class));
                Intent intentStart = new Intent(context, PreyBetaRunnerService.class);
                if (command != null) {
                    intentStart.putExtra("cmd", command);
                }
                context.startService(intentStart);
            }
        }).start();

    }
}

From source file:Main.java

public static boolean stopRunningService(Context ctx, String className) {
    Intent intent_service = null;//from w w  w  . ja v a2s .  c  o  m
    boolean ret = false;
    try {
        intent_service = new Intent(ctx, Class.forName(className));
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (intent_service != null) {
        ret = ctx.stopService(intent_service);
    }
    return ret;
}

From source file:cn.studyjams.s2.sj0132.bowenyan.mygirlfriend.nononsenseapps.notepad.data.service.OrgSyncService.java

public static void stop(Context context) {
    context.stopService(new Intent(context, OrgSyncService.class));
}

From source file:com.github.play.app.StatusService.java

/**
 * Start service with application key// www  .  ja  v a 2  s. c  om
 *
 * @param context
 */
public static void stop(final Context context) {
    context.stopService(new Intent(ACTION));
}