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.alibaba.weex.update.UpdateService.java

public static void startActionUpdate(Context context, String url) {
    Intent intent = new Intent(context, UpdateService.class);
    intent.setAction(ACTION_UPDATE);// ww w.  j  a v a2 s . c  o  m
    intent.putExtra(EXTRA_URL, url);
    context.startService(intent);
}

From source file:org.ado.minesync.service.MineSyncServiceManager.java

public static void startWorldSync(Context context) {
    notNull(context, "context cannot be null");

    ALog.d(TAG, "start world sync.");
    Intent service = new Intent(context, MineSyncService.class);
    service.setAction(MineSyncService.START_SYNC_ACTION);
    context.startService(service);
}

From source file:com.groundupworks.wings.core.WingsService.java

/**
 * Starts this {@link IntentService}, ensuring the device does not sleep before the service is started or during
 * {@link #onHandleIntent(Intent)}.// ww w  . j  a v a 2 s .  com
 *
 * @param context the {@link Context}.
 */
public static void startWakefulService(Context context) {
    acquireWakeLock(context);
    context.startService(new Intent(context, WingsService.class));
}

From source file:net.kayateia.lifestream.UploadService.java

static public void Kick(Context context) {
    final Intent uploadServiceIntent = new Intent(context, UploadService.class);
    context.startService(uploadServiceIntent);
}

From source file:com.sbhstimetable.sbhs_timetable_android.backend.service.NotificationService.java

/**
 * Starts this service to perform action Baz with the given parameters. If
 * the service is already performing a task this action will be queued.
 *
 * @see IntentService//from   ww  w .j  ava  2  s.  c  om
 */
public static void startUpdatingNotification(Context context) {
    Intent intent = new Intent(context, NotificationService.class);
    intent.setAction(ACTION_UPDATE_NOTIFICATION);
    context.startService(intent);
}

From source file:com.asalfo.wiulgi.service.UtilityService.java

public static void requestLocation(@NonNull Context context) {
    Intent intent = new Intent(context, UtilityService.class);
    intent.setAction(UtilityService.ACTION_REQUEST_LOCATION);
    context.startService(intent);
}

From source file:com.google.android.apps.dashclock.PeriodicExtensionRefreshReceiver.java

/**
 * Sets the refresh schedule if one isn't set already.
 *//* w  w w  .java  2 s  . c  o  m*/
public static void updateExtensionsAndEnsurePeriodicRefresh(final Context context) {
    LOGD(TAG, "updateExtensionsAndEnsurePeriodicRefresh");
    AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);

    // Update all extensions now.
    context.startService(getUpdateAllExtensionsIntent(context, DashClockExtension.UPDATE_REASON_MANUAL));

    // Schedule an alarm for every 30 minutes; it will not wake up the device;
    // it will be handled only once the device is awake. The first time that this
    // alarm can go off is in 15 minutes, and the latest time it will go off is
    // 45 minutes from now.
    PendingIntent pi = PendingIntent.getBroadcast(context, 0,
            new Intent(context, PeriodicExtensionRefreshReceiver.class).setAction(ACTION_PERIODIC_ALARM),
            PendingIntent.FLAG_UPDATE_CURRENT);
    am.cancel(pi);
    am.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
            SystemClock.elapsedRealtime() + 15 * MINUTES_MILLIS, AlarmManager.INTERVAL_HALF_HOUR, pi);
}

From source file:com.rks.musicx.services.MediaButtonReceiver.java

/**
 * Start service/*from  ww w.j  av a 2s. co  m*/
 *
 * @param context
 * @param action
 */
public static void startServices(Context context, String action) {
    Intent intent1 = new Intent(context, MusicXService.class);
    intent1.setAction(action);
    context.startService(intent1);
}

From source file:com.oddrun.befrest.Befrest.java

public static void initialize(Context context, int APP_ID, String AUTH, long USER_ID) {
    Befrest.context = context;/*from w  w  w. ja v a  2  s.  c o m*/
    Befrest.U_ID = APP_ID;
    Befrest.AUTH = AUTH;
    Befrest.CH_ID = USER_ID;
    context.startService(new Intent(context, PushService.class).putExtra(PushService.CONNECT, true));
}

From source file:com.androidzeitgeist.webcards.overlay.OverlayService.java

public static void processUrl(Context context, String url) {
    Intent intent = new Intent(context, OverlayService.class);
    intent.setAction(ACTION_OPEN_LINK);/*  www  .  j a  v  a 2 s  .c  o m*/
    intent.putExtra(EXTRA_URL, url);
    context.startService(intent);
}