List of usage examples for android.content Context stopService
public abstract boolean stopService(Intent service);
From source file:Main.java
public static boolean stopRunningService(Context context, String className) { Intent intent_service = null;/*ww w . j av a 2s .c om*/ boolean ret = false; try { intent_service = new Intent(context, Class.forName(className)); } catch (Exception e) { e.printStackTrace(); } if (intent_service != null) { ret = context.stopService(intent_service); } return ret; }
From source file:it.polimi.spf.framework.local.SPFService.java
/** * Sends an intent to SPFService, using the {@link Context} provided, that * makes it stop foreground./* w w w . j a v a2 s .c o m*/ * * @param c - the Context used to send the intent; * @see Service#stopForeground(boolean) */ public static void stopForeground(Context c) { Intent i = new Intent(c, SPFService.class); i.setAction(ACTION_STOP_FOREGROUND); c.startService(i); c.stopService(i); }
From source file:org.qeo.deviceregistration.service.RegisterService.java
/** * Stop the headless registration service. * @param ctx The android context./*from w w w . j av a2 s.c om*/ */ public static void stopHeadlessRegistration(Context ctx) { Intent headlessService = new Intent(ctx, HeadlessRegistrationQeoService.class); ctx.stopService(headlessService); }
From source file:cc.softwarefactory.lokki.android.androidServices.LocationService.java
public static void stop(Context context) { Log.d(TAG, "stop Service called"); context.stopService(new Intent(context, LocationService.class)); }
From source file:org.microg.gms.gcm.McsService.java
public static void stop(Context context) { context.stopService(new Intent(context, McsService.class)); closeAll();/*from w w w.j a v a2 s . c om*/ }
From source file:ch.ethz.twimight.activities.LoginActivity.java
/** * Stop all the alarms and services//from ww w. java 2s . co m */ private static void stopServices(Context context) { TDSAlarm.stopTDSCommuniction(context); context.stopService(new Intent(context, TDSService.class)); ScanningAlarm.stopScanning(context); TwitterAlarm.stopTwitterAlarm(context); }
From source file:nu.yona.app.utils.AppUtils.java
/** * Stop service./*w w w . ja v a2s. co m*/ * * @param context the context */ public static void stopService(Context context) { try { if (activityMonitorIntent != null) { context.stopService(activityMonitorIntent); activityMonitorIntent = null; } } catch (Exception e) { reportException(AppUtils.class.getSimpleName(), e, Thread.currentThread()); } }
From source file:cn.whereyougo.framework.utils.PackageManagerUtil.java
/** * /* w w w.ja v a 2 s . co m*/ * * @param context */ public static void exitApp(final Context context) { ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { if (context.getPackageName().equals(service.service.getPackageName())) { Intent stopIntent = new Intent(); ComponentName serviceCMP = service.service; stopIntent.setComponent(serviceCMP); context.stopService(stopIntent); break; } } android.os.Process.killProcess(android.os.Process.myPid()); System.exit(0); }
From source file:de.schildbach.wallet.service.BlockchainService.java
public static void stop(final Context context) { context.stopService(new Intent(context, BlockchainService.class)); }
From source file:com.secupwn.aimsicd.utils.Helpers.java
/** * Description: Deletes the entire database by removing internal SQLite DB file * //from ww w .ja v a 2 s . co m * * Dependencies: Used in AIMSICD.java * * Notes: See Android developer info: http://tinyurl.com/psz8vmt * * WARNING! * This deletes the entire database, thus any subsequent DB access will FC app. * Therefore we need to either restart app or run AIMSICDDbAdapter, to rebuild DB. * See: #581 * * In addition, since SQLite is kept in memory during lifetime of App, and * is using Journaling, we have to restart app in order to clear old data * already in memory. * * @param pContext Context of Activity */ public static void askAndDeleteDb(final Context pContext) { AlertDialog lAlertDialog = new AlertDialog.Builder(pContext) .setNegativeButton(R.string.open_cell_id_button_cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }).setPositiveButton(R.string.open_cell_id_button_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Probably put in try/catch in case file removal fails... pContext.stopService(new Intent(pContext, AimsicdService.class)); pContext.deleteDatabase("aimsicd.db"); new RealmHelper(pContext); pContext.startService(new Intent(pContext, AimsicdService.class)); msgLong(pContext, pContext.getString(R.string.delete_database_msg_success)); } }).setMessage(pContext.getString(R.string.clear_database_question)) .setTitle(R.string.clear_database).setCancelable(false) .setIcon(R.drawable.ic_action_delete_database).create(); lAlertDialog.show(); }