List of usage examples for android.content Context startService
@Nullable public abstract ComponentName startService(Intent service);
From source file:nl.sogeti.android.gpstracker.integration.GPSLoggerServiceManager.java
public static void startGPSLogging(Context context, String trackName) { Intent intent = createServiceIntent(); intent.putExtra(ExternalConstants.Commands.COMMAND, ExternalConstants.Commands.EXTRA_COMMAND_START); intent.putExtra(ExternalConstants.EXTRA_TRACK_NAME, trackName); context.startService(intent); }
From source file:com.actinarium.nagbox.service.NagboxService.java
/** * Update task status (flags). Use this to start or stop the task. {@link Task#id} must be set. Will result in * rescheduling the alarm to closer time if needed. * * @param context context/* www .ja va 2s .c o m*/ * @param task task to update its flags */ public static void updateTaskStatus(Context context, Task task) { Intent intent = new Intent(context, NagboxService.class); intent.setAction(ACTION_UPDATE_TASK_STATUS); intent.putExtra(EXTRA_TASK, task); context.startService(intent); }
From source file:com.actinarium.nagbox.service.NagboxService.java
/** * Delete the task entirely. Will trigger rescheduling the alarm to later time if needed, or cancelling it. * * @param context context// www . j a v a 2s .c o m * @param taskId ID of the task to delete */ public static void deleteTask(Context context, long taskId) { Intent intent = new Intent(context, NagboxService.class); intent.setAction(ACTION_DELETE_TASK); intent.putExtra(EXTRA_TASK_ID, taskId); context.startService(intent); }
From source file:com.adam.aslfms.util.Util.java
public static void copyIfPossible(Context ctx) { try {//from w w w . j a v a 2 s. c o m Intent service = new Intent(ctx, ScrobblingService.class); service.setAction(ScrobblingService.ACTION_COPY); ctx.startService(service); } catch (Exception e) { Toast.makeText(ctx, ctx.getString(R.string.no_copy_track), Toast.LENGTH_LONG).show(); Log.e(TAG, "CAN'T COPY TRACK" + e); } }
From source file:com.adam.aslfms.util.Util.java
public static void heartIfPossible(Context ctx) { try {/*from w w w. ja va2 s.com*/ Intent service = new Intent(ctx, ScrobblingService.class); service.setAction(ScrobblingService.ACTION_HEART); ctx.startService(service); } catch (Exception e) { Toast.makeText(ctx, ctx.getString(R.string.no_heart_track), Toast.LENGTH_LONG).show(); Log.e(TAG, "CAN'T HEART TRACK" + e); } }
From source file:com.asburymotors.android.disneysocal.service.UtilityService.java
public static void addGeofences(Context context) { Intent intent = new Intent(context, UtilityService.class); intent.setAction(UtilityService.ACTION_ADD_GEOFENCES); context.startService(intent); }
From source file:org.chromium.chrome.browser.media.MediaNotificationService.java
/** * Clear any previous media notifications. *//*from w w w .jav a 2 s . co m*/ public static void clearMediaNotifications(Context context) { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); Set<String> notificationIds = sharedPreferences.getStringSet(MEDIA_NOTIFICATION_IDS, null); if (notificationIds == null || notificationIds.isEmpty()) return; context.startService(new Intent(context, MediaNotificationService.class)); }
From source file:com.asburymotors.android.disneysocal.service.UtilityService.java
public static void requestLocation(Context context) { Intent intent = new Intent(context, UtilityService.class); intent.setAction(UtilityService.ACTION_REQUEST_LOCATION); context.startService(intent); }
From source file:com.asburymotors.android.disneysocal.service.UtilityService.java
public static void clearNotification(Context context) { Intent intent = new Intent(context, UtilityService.class); intent.setAction(UtilityService.ACTION_CLEAR_NOTIFICATION); context.startService(intent); }
From source file:org.compose.mobilesdk.android.COMPOSESubService.java
/** * Stop MQTT Client//from w w w .j av a 2s . c o m * @param Context context to start the service with * @return void */ public static void actionStop(Context ctx) { Intent i = new Intent(ctx, COMPOSESubService.class); i.setAction(ACTION_STOP); ctx.startService(i); }