library/src/main/java/com/coolerfall/daemon/Daemon.java
private static void start(Context context, Class<?> daemonClazzName, int interval) {
		String cmd = context.getDir(BIN_DIR_NAME, Context.MODE_PRIVATE)
			.getAbsolutePath() + File.separator + DAEMON_BIN_NAME;

		/* create the command string */
		StringBuilder cmdBuilder = new StringBuilder();
		cmdBuilder.append(cmd);
		cmdBuilder.append(" -p ");
		cmdBuilder.append(context.getPackageName());
		cmdBuilder.append(" -s ");
		cmdBuilder.append(daemonClazzName.getName());
		cmdBuilder.append(" -t ");
		cmdBuilder.append(interval);

		try {
			Runtime.getRuntime().exec(cmdBuilder.toString()).waitFor();
		} catch (IOException | InterruptedException e) {
			Log.e(TAG, "start daemon error: " + e.getMessage());
		}
	}
private static void start(Context context, Class<?> daemonClazzName, int interval) {
		String cmd = context.getDir(BIN_DIR_NAME, Context.MODE_PRIVATE)
			.getAbsolutePath() + File.separator + DAEMON_BIN_NAME;

		/* create the command string */
		StringBuilder cmdBuilder = new StringBuilder();
		cmdBuilder.append(cmd);
		cmdBuilder.append(" -p ");
		cmdBuilder.append(context.getPackageName());
		cmdBuilder.append(" -s ");
		cmdBuilder.append(daemonClazzName.getName());
		cmdBuilder.append(" -t ");
		cmdBuilder.append(interval);

		try {
			Runtime.getRuntime().exec(cmdBuilder.toString()).waitFor();
		} catch (IOException | InterruptedException e) {
			Log.e(TAG, "start daemon error: " + e.getMessage());
		}
	}
private static void start ( Context context , Class < ? > daemonClazzName , int interval ) { String cmd = context . getDir ( BIN_DIR_NAME , Context . MODE_PRIVATE ) . getAbsolutePath ( ) + File . separator + DAEMON_BIN_NAME ; /* create the command string */ StringBuilder cmdBuilder = new StringBuilder ( ) ; cmdBuilder . append ( cmd ) ; cmdBuilder . append ( " -p " ) ; cmdBuilder . append ( context . getPackageName ( ) ) ; cmdBuilder . append ( " -s " ) ; cmdBuilder . append ( daemonClazzName . getName ( ) ) ; cmdBuilder . append ( " -t " ) ; cmdBuilder . append ( interval ) ; try { Runtime . getRuntime ( ) . exec ( cmdBuilder . toString ( ) ) . waitFor ( ) ; } catch ( IOException | InterruptedException e ) { Log . e ( TAG , "start daemon error: " + e . getMessage ( ) ) ; } }
start daemon
start daemon