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:com.actinarium.rhythm.control.RhythmNotificationService.java

/**
 * Show the “Quick Control” notification, which allows to switch overlays for all connected Rhythm
 * groups without leaving the app under development. Can be used to update the notification as well.
 *
 * @param context        to start the service
 * @param notificationId Notification ID, must be unique across the app
 *//*from  ww w . j  ava2s. c o  m*/
static void showNotification(Context context, int notificationId) {
    Intent intent = new Intent(context, RhythmNotificationService.class);
    intent.setAction(ACTION_SHOW_QUICK_CONTROL);
    intent.putExtra(EXTRA_NOTIFICATION_ID, notificationId);
    context.startService(intent);
}

From source file:butter.droid.base.torrent.TorrentService.java

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

From source file:nl.sogeti.android.gpstracker.integration.GPSLoggerServiceManager.java

public static void setLoggingPrecision(Context context, int mode) {
    Intent intent = createServiceIntent();
    intent.putExtra(ExternalConstants.Commands.CONFIG_PRECISION, mode);
    context.startService(intent);
}

From source file:pub.devrel.easygoogle.gcm.MessagingFragment.java

protected static void send(Context context, String senderId, Bundle data) {
    Intent intent = new Intent(context, MessageSenderService.class);
    intent.putExtra(SENDER_ID_ARG, senderId);
    intent.putExtra(MESSAGE_ARG, data);//from   w w  w.  ja  v  a  2 s. c o m
    intent.putExtra(GCM_PERMISSION_ARG, getGcmPermissionName(context));
    context.startService(intent);
}

From source file:com.mishiranu.dashchan.content.service.AudioPlayerService.java

public static void start(Context context, String chanName, Uri uri, String fileName) {
    context.startService(obtainIntent(context, ACTION_START).setData(uri).putExtra(EXTRA_CHAN_NAME, chanName)
            .putExtra(EXTRA_FILE_NAME, fileName));
}

From source file:org.akop.crosswords.service.CrosswordFetchService.java

public static void startService(Context context, CrosswordFetchRunnable.Request[] requests,
        boolean broadcastResults, boolean writeToStorage) {
    Intent intent = new Intent(context, CrosswordFetchService.class);
    intent.putExtra("requests", requests);
    intent.putExtra("writeToStorage", writeToStorage);
    intent.putExtra("broadcastResults", broadcastResults);
    context.startService(intent);
}

From source file:nl.sogeti.android.gpstracker.integration.GPSLoggerServiceManager.java

public static void setSanityFilter(Context context, boolean filter) {
    Intent intent = createServiceIntent();
    intent.putExtra(ExternalConstants.Commands.CONFIG_SPEED_SANITY, filter);
    context.startService(intent);
}

From source file:org.jraf.android.dcn.handheld.app.geofencing.GeofencingService.java

public static void refresh(Context context) {
    Log.d();/*from  w  ww . j a v a2 s  .  com*/
    Intent intent = new Intent(context, GeofencingService.class);
    intent.setAction(ACTION_REFRESH_GEOFENCES);
    context.startService(intent);
}

From source file:nl.sogeti.android.gpstracker.integration.GPSLoggerServiceManager.java

public static void setStatusMonitor(Context context, boolean monitor) {
    Intent intent = createServiceIntent();
    intent.putExtra(ExternalConstants.Commands.CONFIG_STATUS_MONITOR, monitor);
    context.startService(intent);
}

From source file:galilei.kelimekavanozu.AppService.java

public static void createPoem(Context ctx, String text, int drawableId, String theme, String createdAt) {
    final Intent i = new Intent(ctx, AppService.class).putExtra(PARAM_OP, OP_CREATE_POEM)
            .putExtra(PoemContract.Columns.TEXT, text).putExtra(PoemContract.Columns.IMAGE, drawableId)
            .putExtra(PoemContract.Columns.THEME, theme).putExtra(PoemContract.Columns.CREATED_AT, createdAt);
    ctx.startService(i);
}