List of usage examples for android.content Context startService
@Nullable public abstract ComponentName startService(Intent service);
From source file:Main.java
private static void syncContactHiResPhoto(Context context, long rawContactId) { final String serviceName = "com.google.android.syncadapters.contacts." + "SyncHighResPhotoIntentService"; final String servicePackageName = "com.google.android.syncadapters.contacts"; final Uri uri = ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId); final Intent intent = new Intent(); intent.setClassName(servicePackageName, serviceName); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(uri, RawContacts.CONTENT_ITEM_TYPE); try {//ww w .j a v a2s. co m context.startService(intent); } catch (Exception e) { } }
From source file:org.compose.mobilesdk.android.COMPOSESubService.java
/** * Start MQTT Client/*from ww w .ja v a2 s . c om*/ * @param Context context to start the service with * @return void */ public static void actionStart(Context ctx) { Intent i = new Intent(ctx, COMPOSESubService.class); i.setAction(ACTION_START); ctx.startService(i); }
From source file:com.prey.beta.actions.PreyBetaController.java
public static void startPrey(Context ctx, String cmd) { PreyConfig config = PreyConfig.getPreyConfig(ctx); if (config.isThisDeviceAlreadyRegisteredWithPrey()) { // Cancelling the notification of the SMS that started Prey PreyConfig.getPreyConfig(ctx).setCanAccessCamara(PreyPermission.canAccessCamera(ctx)); PreyConfig.getPreyConfig(ctx).setCanAccessCoarseLocation(PreyPermission.canAccessCoarseLocation(ctx)); PreyConfig.getPreyConfig(ctx).setCanAccessFineLocation(PreyPermission.canAccessFineLocation(ctx)); PreyConfig.getPreyConfig(ctx).setCanAccessReadPhoneState(PreyPermission.canAccessReadPhoneState(ctx)); config.setRun(true);/*from w w w . j a v a2 s . c o m*/ final Context context = ctx; final String command = cmd; new Thread(new Runnable() { public void run() { //First need to stop a previous running instance. context.stopService(new Intent(context, PreyBetaRunnerService.class)); Intent intentStart = new Intent(context, PreyBetaRunnerService.class); if (command != null) { intentStart.putExtra("cmd", command); } context.startService(intentStart); } }).start(); } }
From source file:org.compose.mobilesdk.android.COMPOSESubService.java
/** * Send a KeepAlive Message/*from w ww .jav a 2 s. c om*/ * @param Context context to start the service with * @return void */ public static void actionKeepalive(Context ctx) { Intent i = new Intent(ctx, COMPOSESubService.class); i.setAction(ACTION_KEEPALIVE); ctx.startService(i); }
From source file:com.fanfou.app.opensource.service.DownloadService.java
public static void startDownload(final Context context, final AppVersionInfo info) { final Intent intent = new Intent(context, DownloadService.class); intent.putExtra(Constants.EXTRA_TYPE, DownloadService.TYPE_DOWNLOAD); intent.putExtra(Constants.EXTRA_URL, info); context.startService(intent); }
From source file:com.owncloud.android.services.observer.FileObserverService.java
/** * Requests the update of the observers responsible to watch folders where new files * should be automatically added to OC, according to changes in instant upload settings. * * @param context Android context of the caller component. *//*from w ww . j a v a2s.c o m*/ public static void updateInstantUploadsObservers(Context context) { Intent intent = new Intent(context, FileObserverService.class); intent.setAction(FileObserverService.ACTION_UPDATE_AUTO_UPLOAD_OBSERVERS); context.startService(intent); }
From source file:org.klnusbaum.udj.PlayerActivity.java
private static void setVolume(Context context, Account account, int newVolume) { Intent setPlaybackIntent = new Intent(Constants.ACTION_SET_VOLUME, Constants.PLAYER_URI, context, PlaylistSyncService.class); setPlaybackIntent.putExtra(Constants.ACCOUNT_EXTRA, account); setPlaybackIntent.putExtra(Constants.PLAYER_VOLUME_EXTRA, newVolume); context.startService(setPlaybackIntent); }
From source file:com.vg.api.VGClient.java
public static void initBilling(Context con, String appLicenseKey, ConsumableCallBack ccb) { IABKEY = appLicenseKey;/* w w w . j ava 2 s .co m*/ if (ccb != null) { consumableImpl = ccb; } mCurrentAndroidContext = con.getApplicationContext(); //start in app purchase background service con.startService(new Intent(con, IABHelperService.class)); }
From source file:org.chromium.chrome.browser.media.MediaCaptureNotificationService.java
/** * Clear any previous media notifications. *//* w w w . j a va2 s . co m*/ public static void clearMediaNotifications(Context context) { SharedPreferences sharedPreferences = ContextUtils.getAppSharedPreferences(); Set<String> notificationIds = sharedPreferences.getStringSet(WEBRTC_NOTIFICATION_IDS, null); if (notificationIds == null || notificationIds.isEmpty()) return; context.startService(new Intent(context, MediaCaptureNotificationService.class)); }
From source file:com.github.play.app.StatusService.java
/** * Start service with application key/*from w ww.j a va 2 s. c o m*/ * * @param context * @param applicationKey * @param sendNotification * @param nowPlaying */ public static void start(final Context context, final String applicationKey, final boolean sendNotification, final Song nowPlaying) { Intent intent = new Intent(ACTION); intent.putExtra(EXTRA_KEY, applicationKey); intent.putExtra(EXTRA_NOTIFY, sendNotification); intent.putExtra(EXTRA_SONG, nowPlaying); context.startService(intent); }