List of usage examples for android.content Context startService
@Nullable public abstract ComponentName startService(Intent service);
From source file:eu.faircode.netguard.SinkholeService.java
public static void start(Context context) { Intent intent = new Intent(context, SinkholeService.class); intent.putExtra(EXTRA_COMMAND, Command.start); context.startService(intent); }
From source file:com.snda.mymarket.providers.downloads.DownloadService.java
/** * pause all download.<br>/*w w w . j a v a 2 s . c om*/ * <b>Note:</b> This method will not pause the downloads which are running * now, but denies to start new downloads. * * @param context */ public static void pauseAllDownload(Context context) { Intent intent = new Intent(context, DownloadService.class); intent.setAction(ACTION_PAUSE_ALL); intent.putExtra(EXTRA_IS_PAUSE_ALL, true); context.startService(intent); }
From source file:com.snda.mymarket.providers.downloads.DownloadService.java
/** * resume all download.<br>/* w w w. j av a 2s. c o m*/ * <b>Note:</b> This method will not resume the downloads which are running * now, but allows to start new downloads. * * @param context */ public static void resumeAllDownload(Context context) { Intent intent = new Intent(context, DownloadService.class); intent.setAction(ACTION_PAUSE_ALL); intent.putExtra(EXTRA_IS_PAUSE_ALL, false); context.startService(intent); }
From source file:com.owncloud.android.services.observer.FileObserverService.java
/** * Requests an ACTION_START_OBSERVE command to (re)initialize the observer service. * // ww w . jav a 2 s .c o m * @param context Android context of the caller component. */ public static void initialize(Context context) { Intent i = new Intent(context, FileObserverService.class); i.setAction(ACTION_START_OBSERVE); context.startService(i); }
From source file:com.commonsware.android.tte.DocumentStorageService.java
public static void saveDocument(Context ctxt, Uri document, String text, boolean isClosing) { Intent i = new Intent(ctxt, DocumentStorageService.class).setAction(Intent.ACTION_EDIT).setData(document) .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION) .putExtra(Intent.EXTRA_TEXT, text).putExtra(EXTRA_CLOSING, isClosing); ctxt.startService(i); }
From source file:com.actinarium.nagbox.service.NagboxService.java
/** * Create a new unstarted task. Doesn't trigger rescheduling alarms. * * @param context context/* w w w . j a va 2 s.c om*/ * @param task task to create */ public static void createTask(Context context, Task task) { Intent intent = new Intent(context, NagboxService.class); intent.setAction(ACTION_CREATE_TASK); intent.putExtra(EXTRA_TASK, task); context.startService(intent); }
From source file:com.actinarium.nagbox.service.NagboxService.java
/** * Update task description. Doesn't update the flags (i.e. doesn't start or stop the task), and as of now it doesn't * reschedule next alarm either. If you need to update task status, use {@link #updateTaskStatus(Context, Task)}. * {@link Task#id} must be set.// w w w.ja va2s.c o m * * @param context context * @param task task to update */ public static void updateTask(Context context, Task task) { Intent intent = new Intent(context, NagboxService.class); intent.setAction(ACTION_UPDATE_TASK); intent.putExtra(EXTRA_TASK, task); context.startService(intent); }
From source file:com.actinarium.nagbox.service.NagboxService.java
/** * Same as {@link #createTask(Context, Task)}, but will insert the task with its old ID and trigger rescheduling the * alarm.// w ww .jav a2s. c o m * * @param context context * @param task task to restore */ public static void restoreTask(Context context, Task task) { Intent intent = new Intent(context, NagboxService.class); intent.setAction(ACTION_RESTORE_TASK); intent.putExtra(EXTRA_TASK, task); context.startService(intent); }
From source file:nl.sogeti.android.gpstracker.integration.GPSLoggerServiceManager.java
public static void setCustomLoggingPrecision(Context context, long seconds, float meters) { Intent intent = createServiceIntent(); intent.putExtra(ExternalConstants.Commands.CONFIG_INTERVAL_TIME, seconds); intent.putExtra(ExternalConstants.Commands.CONFIG_INTERVAL_DISTANCE, meters); context.startService(intent); }
From source file:org.kontalk.service.DownloadService.java
public static void abort(Context context, Uri uri) { Intent i = new Intent(context, DownloadService.class); i.setAction(DownloadService.ACTION_DOWNLOAD_ABORT); i.setData(uri);//from w ww . j a va 2s.com context.startService(i); }