List of usage examples for android.content Context startService
@Nullable public abstract ComponentName startService(Intent service);
From source file:com.finchuk.clock2.timers.TimerNotificationService.java
/** * Helper method to cancel the notification previously shown from calling * {@link #showNotification(Context, Timer)}. This does NOT start the Service * and call through to {@link #onStartCommand(Intent, int, int)}, because * the work does not require so./* w w w . ja va2 s . c o m*/ * @param timerId the id of the Timer associated with the notification * you want to cancel */ public static void cancelNotification(Context context, long timerId) { Intent intent = new Intent(context, TimerNotificationService.class).setAction(ACTION_CANCEL_NOTIFICATION) .putExtra(EXTRA_CANCEL_TIMER_ID, timerId); context.startService(intent); }
From source file:nl.sogeti.android.gpstracker.integration.GPSLoggerServiceManager.java
public static void stopGPSLogging(Context context) { Intent intent = createServiceIntent(); intent.putExtra(ExternalConstants.Commands.COMMAND, ExternalConstants.Commands.EXTRA_COMMAND_STOP); context.startService(intent); }
From source file:nl.sogeti.android.gpstracker.integration.GPSLoggerServiceManager.java
public static void pauseGPSLogging(Context context) { Intent intent = createServiceIntent(); intent.putExtra(ExternalConstants.Commands.COMMAND, ExternalConstants.Commands.EXTRA_COMMAND_PAUSE); context.startService(intent); }
From source file:org.restcomm.app.utillib.Utils.Global.java
public static void stopService(Context context) { Intent bgServiceIntent = new Intent(); bgServiceIntent//from w w w.j a v a 2 s . com .setComponent(new ComponentName(context.getPackageName(), "com.cortxt.app.corelib.MainService")); context.startService(bgServiceIntent); }
From source file:com.conferenceengineer.android.iosched.util.SessionsHelper.java
public static void uploadStarredSession(Context context, Uri sessionUri, boolean starred) { final Intent updateServerIntent = new Intent(context, ScheduleUpdaterService.class); updateServerIntent.putExtra(ScheduleUpdaterService.EXTRA_SESSION_ID, ScheduleContract.Sessions.getSessionId(sessionUri)); updateServerIntent.putExtra(ScheduleUpdaterService.EXTRA_IN_SCHEDULE, starred); context.startService(updateServerIntent); }
From source file:nl.sogeti.android.gpstracker.integration.GPSLoggerServiceManager.java
public static void resumeGPSLogging(Context context) { Intent intent = createServiceIntent(); intent.putExtra(ExternalConstants.Commands.COMMAND, ExternalConstants.Commands.EXTRA_COMMAND_RESUME); context.startService(intent); }
From source file:cc.softwarefactory.lokki.android.services.LocationService.java
public static void start(Context context) { Log.e(TAG, "start Service called"); if (serviceRunning || !MainApplication.visible) { // If service is running, no need to start it again. Log.e(TAG, "Service already running..."); return;/*from ww w . j av a 2 s .c om*/ } context.startService(new Intent(context, LocationService.class)); }
From source file:ch.carteggio.provider.sync.NotificationService.java
public static void updateUnreadNotification(Context c) { Intent service = new Intent(c, NotificationService.class); service.setAction(UPDATE_UNREAD_STATE_ACTION); c.startService(service); }
From source file:com.github.nutomic.pegasus.LocationService.java
/** * Convenience method for sending an Intent with MESSAGE_UPDATE * to the service.//w w w .j a v a2s .c o m * * @param context Application context. */ public static void sendUpdateIntent(Context context) { Intent i = new Intent(context, LocationService.class); // Value is unused. i.putExtra(MESSAGE_UPDATE, 0); context.startService(i); }
From source file:cc.softwarefactory.lokki.android.services.LocationService.java
public static void run1min(Context context) { if (serviceRunning || !MainApplication.visible) { return; // If service is running, stop }/* w w w. ja v a 2 s . com*/ Log.e(TAG, "run1min called"); Intent intent = new Intent(context, LocationService.class); intent.putExtra(RUN_1_MIN, 1); context.startService(intent); }