Example usage for android.content Context startService

List of usage examples for android.content Context startService

Introduction

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

Prototype

@Nullable
public abstract ComponentName startService(Intent service);

Source Link

Document

Request that a given application service be started.

Usage

From source file:Main.java

public static <T> void startService(Context context, Class<T> clazz) {
    Intent i = new Intent(context, clazz);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startService(i);
}

From source file:Main.java

public static void startService(Context context, String className) {
    try {//from ww w  . j a  v  a2  s  .c om
        Intent intent = new Intent(context, Class.forName(className));
        context.startService(intent);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.samknows.measurement.MainService.java

public static void poke(Context ctx) {
    ctx.startService(new Intent(ctx, MainService.class));
}

From source file:de.schildbach.wallet.service.InactivityNotificationService.java

public static void startMaybeShowNotification(final Context context) {
    context.startService(new Intent(context, InactivityNotificationService.class));
}

From source file:com.plusub.lib.example.service.RequestService.java

public static void startService(Context context) {
    Intent intent = new Intent(context, RequestService.class);
    context.startService(intent);
}

From source file:at.ac.uniklu.mobile.sportal.notification.GCMUtils.java

public static void notifyUser(Context context) {
    context.startService(new Intent(context, GCMCampusService.class).setAction(GCMCampusService.ACTION_NOTIFY));
}

From source file:Main.java

public static void UnRegister(Context context) {
    Intent unregIntent = new Intent("com.google.android.c2dm.intent.UNREGISTER");
    unregIntent.putExtra("app", PendingIntent.getBroadcast(context, 0, new Intent(), 0));
    context.startService(unregIntent);
}

From source file:org.alpine_toolkit.AlpineToolkitService.java

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

From source file:name.gudong.translate.listener.ListenClipboardService.java

public static void start(Context context) {
    Intent serviceIntent = new Intent(context, ListenClipboardService.class);
    context.startService(serviceIntent);
}

From source file:at.ac.uniklu.mobile.sportal.notification.GCMUtils.java

public static void registerToCampus(Context context, String regId) {
    context.startService(new Intent(context, GCMCampusService.class).setAction(GCMCampusService.ACTION_REGISTER)
            .putExtra(GCMCampusService.EXTRA_REGID, regId));
}