Context stopService - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Context stopService method.

This code example shows how to use the following methods:getSystemService, stopService
		Log.d(TAG, "Timeout start");
		am.set(AlarmManager.RTC, triggerTime, buildIntent(ctx));
	} 
	 
	public static void cancel(Context ctx) {
		AlarmManager am = (AlarmManager) ctx.getSystemService(Context.ALARM_SERVICE);
		 
		Log.d(TAG, "Timeout cancel");
		am.cancel(buildIntent(ctx));
		 
		ctx.stopService(new Intent(ctx, TimeoutService.class));
 
	} 
 
} 
7
CodeRank
This code example shows how to use the following methods:stopService
    public static void stop(Context context) {
        Intent intent = new Intent();
        intent.setComponent(new ComponentName(
                "com.android.cts.usespermissiondiffcertapp", 
                "com.android.cts.usespermissiondiffcertapp.ReceiveUriService")); 
        context.stopService(intent);
    } 
 
    public static int getCurStartId() { 
        synchronized (sLock) {
            return sCurStartId;
        } 
    } 
 
    public static void stopCurWithId(int id) {
        synchronized (sLock) {
            sCurInstance.stopSelf(id);
        } 
    } 
 
6
CodeRank
This code example shows how to use the following methods:stopService
	} 
 
	@Override 
	public void stopModule() { 
		if(service != null)
			androidContext.stopService(new Intent(androidContext, WebinosSocketService.class));
	} 
} 
6
CodeRank
This code example shows how to use the following methods:getSystemService, getClass
This code example shows how to use the following methods:getSystemService, getClass
        mSetForegroundArgs[0] = Boolean.FALSE;
        invokeMethod(mSetForeground, mSetForegroundArgs);
    } 
 
    public void init() { 
        mNM = (NotificationManager) mService.getSystemService(Service.NOTIFICATION_SERVICE);
        try { 
            mStartForeground = mService.getClass().getMethod("startForeground",
                    mStartForegroundSignature);
            mStopForeground = mService.getClass().getMethod("stopForeground",
                    mStopForegroundSignature);
            return; 
        } catch (NoSuchMethodException e) {
            // Running on an older platform. 
            mStartForeground = mStopForeground = null;
        } 
        try { 
            mSetForeground = mService.getClass()
                    .getMethod("setForeground", mSetForegroundSignature);
        } catch (NoSuchMethodException e) {

7
CodeRank
This code example shows how to use the following methods:getSystemService, getClass
This code example shows how to use the following methods:stopForeground
class StopForegroundWrapper 
{ 
	public void stopForegroundAndRemoveNotificationIcon(Service service)
	{ 
		// The true argument removes the notification icon. 
		service.stopForeground(true);
	} 
} 
 
6
CodeRank
This code example shows how to use the following methods:setForeground
			private static final PreEclair sInstance = new PreEclair();
		} 
 
		@Override 
		public void showRunningNotification(Service context) {
			context.setForeground(true);
			getNotificationManager(context).notify(ONLINE_NOTIFICATION, newRunningNotification(context));
		} 
 
		@Override 
		public void hideRunningNotification(Service context) {
			context.setForeground(false);
			getNotificationManager(context).cancel(ONLINE_NOTIFICATION);
		} 
	} 
 
	private static class EclairAndBeyond extends ConnectionNotifier { 
		private static class Holder { 
			private static final EclairAndBeyond sInstance = new EclairAndBeyond();
		} 
5
CodeRank
This code example shows how to use the following methods:startForeground
	public void hideActivityNotification(Service context) {
		getNotificationManager(context).cancel(ACTIVITY_NOTIFICATION);
	} 
 
	public void showRunningNotification(Service context) {
		context.startForeground(ONLINE_NOTIFICATION, newRunningNotification(context));
	} 
 
	public void hideRunningNotification(Service context) {
		context.stopForeground(true);
	} 
} 
5
CodeRank
This code example shows how to use the following methods:startForeground
			private static final EclairAndBeyond sInstance = new EclairAndBeyond();
		} 
 
		@Override 
		public void showRunningNotification(Service context) {
			context.startForeground(ONLINE_NOTIFICATION, newRunningNotification(context));
		} 
 
		@Override 
		public void hideRunningNotification(Service context) {
			context.stopForeground(true);
		} 
	} 
} 
5
CodeRank

Related Context stopService Questions & Answers:

stopService Method Overview
Request that a given application service be stopped.
See Code Examples for other Android Context Methods: