List of usage examples for android.content Context startService
@Nullable public abstract ComponentName startService(Intent service);
From source file:net.kayateia.lifestream.StreamService.java
static public void Kick(Context context) { final Intent serviceStartIntent = new Intent(context, StreamService.class); context.startService(serviceStartIntent); }
From source file:com.asalfo.wiulgi.service.UtilityService.java
public static void requestRecommendation(@NonNull Context context) { Intent intent = new Intent(context, UtilityService.class); intent.putExtra(Constants.TAG, Constants.INIT); intent.setAction(UtilityService.ACTION_RECOMMENDATIONS); context.startService(intent); }
From source file:org.ado.minesync.service.MineSyncServiceManager.java
public static void stopWorldSync(Context context) { notNull(context, "context cannot be null"); ALog.d(TAG, "stop world sync."); Intent service = new Intent(context, MineSyncService.class); service.setAction(MineSyncService.STOP_SYNC_ACTION); service.putExtra(INTENT_PARAMETER_MINESYNC_UPLOADING_WORLD, true); context.startService(service); }
From source file:com.bluros.updater.service.DownloadService.java
public static void start(Context context, UpdateInfo ui) { Intent intent = new Intent(context, DownloadService.class); intent.putExtra(EXTRA_UPDATE_INFO, (Parcelable) ui); context.startService(intent); }
From source file:com.prey.actions.location.LocationUtil.java
public static PreyLocation getPreyLocationAppService(Context ctx, String method) throws Exception { PreyLocation location = null;//from www . j ava2s .co m Intent intent = new Intent(ctx, LocationService.class); try { ctx.startService(intent); boolean validLocation = false; int i = 0; while (!validLocation) { location = PreyLocationManager.getInstance(ctx).getLastLocation(); if (location.isValid()) { validLocation = true; } else { try { Thread.sleep(5000); } catch (InterruptedException e) { throw new PreyException("Thread was intrrupted. Finishing Location NotifierAction", e); } if (i > 2) { return null; } i++; } location.setMethod(method); } ctx.stopService(intent); } catch (Exception e) { Map<String, String> parms = UtilJson.makeMapParam("get", "location", "failed", e.getMessage()); PreyWebServices.getInstance().sendNotifyActionResultPreyHttp(ctx, parms); } finally { ctx.stopService(intent); } return location; }
From source file:cc.softwarefactory.lokki.android.services.DataService.java
public static void start(Context context) { Log.e(TAG, "start Service called"); if (serviceRunning) { // If service is running, no need to start it again. Log.e(TAG, "Service already running..."); return;// w w w . j a v a 2 s . com } context.startService(new Intent(context, DataService.class)); }
From source file:com.android.tv.settings.device.storage.SettingsStorageService.java
public static void unmount(Context context, String volumeId) { final Intent intent = new Intent(context, Impl.class); intent.setAction(ACTION_UNMOUNT);/* w ww. j a v a2 s .c o m*/ intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, volumeId); context.startService(intent); }
From source file:com.android.tv.settings.device.storage.SettingsStorageService.java
public static void formatAsPublic(Context context, String diskId) { final Intent intent = new Intent(context, Impl.class); intent.setAction(ACTION_FORMAT_AS_PUBLIC); intent.putExtra(DiskInfo.EXTRA_DISK_ID, diskId); context.startService(intent); }
From source file:org.kegbot.app.service.CheckinService.java
public static void startCheckinService(Context context) { final Intent intent = new Intent(context, CheckinService.class); context.startService(intent); }
From source file:com.android.tv.settings.device.storage.SettingsStorageService.java
public static void formatAsPrivate(Context context, String diskId) { final Intent intent = new Intent(context, Impl.class); intent.setAction(ACTION_FORMAT_AS_PRIVATE); intent.putExtra(DiskInfo.EXTRA_DISK_ID, diskId); context.startService(intent); }