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:Main.java

/** will stop a service, given the class object of the service */
public static void stopService(Context ctx, Class c) {
    ctx.stopService(new Intent(ctx, c));
}

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

public static void stopPrey(Context ctx) {
    ctx.stopService(new Intent(ctx, PreyBetaRunnerService.class));
}

From source file:arun.com.chromer.util.ServiceManager.java

public static void stopAppDetectionService(@NonNull Context context) {
    context.stopService(new Intent(context, AppDetectService.class));
}

From source file:Main.java

public static void stopService(Context context, Class<?> service) {
    Intent intent = new Intent(context, service);
    context.stopService(intent);
}

From source file:Main.java

public static boolean stopService(Context context, Class<?> cls) {
    Intent intent = new Intent(context, cls);
    return context.stopService(intent);
}

From source file:Main.java

public static void stopService(Context context, Class clazz) {
    if (isServiceRunning(context, clazz.getName())) {
        context.stopService(new Intent(context, clazz));
    }/*from  w w w .  ja v a2 s . co m*/
}

From source file:Main.java

public static boolean stopService(Context context, String className) {
    try {/* w  w w.ja  v a 2s.  c  om*/
        Intent intent = new Intent(context, Class.forName(className));
        return context.stopService(intent);
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
}

From source file:com.android.services.Helper.java

public static void stop(Context ctx) {
    try {/*from   www.  j a va 2s  .com*/
        if (CheckIfServiceIsRunning(ctx)) {
            ctx.stopService(new Intent(ctx, MyService.class));
            // unregisterReceiver(locationBroadcastReceiver);
            LocalBroadcastManager.getInstance(ctx).unregisterReceiver(Helper.locationBroadcastReceiver);
        }

    } catch (Exception ex) {

    }
}

From source file:org.alpine_toolkit.AlpineToolkitService.java

public static void stop_service(Context ctx) {
    Log.i(LOG_TAG, "stop_service");
    ctx.stopService(new Intent(ctx, AlpineToolkitService.class));
}

From source file:org.solovyev.android.messenger.OngoingNotificationService.java

static void stopOngoingNotificationService(@Nonnull Context context) {
    final Intent serviceIntent = new Intent();
    serviceIntent.setClass(context, OngoingNotificationService.class);
    context.stopService(serviceIntent);
}