Android examples for Intent:Open App
stop the running service via Intent.
//package com.java2s; import android.content.Context; import android.content.Intent; public class Main { /**/*from w w w. ja v a 2 s .c o m*/ * stop the running service. */ public static boolean stopRunningService(Context context, String className) { Intent serviceIntent = null; boolean result = false; try { serviceIntent = new Intent(context, Class.forName(className)); if (serviceIntent != null) { result = context.stopService(serviceIntent); } } catch (Exception e) { e.printStackTrace(); } return result; } }