Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.Intent; public class Main { public static boolean stopRunningService(Context ctx, String className) { Intent intent_service = null; boolean ret = false; try { intent_service = new Intent(ctx, Class.forName(className)); } catch (Exception e) { } if (intent_service != null) { ret = ctx.stopService(intent_service); } return ret; } }