Code example for ContextWrapper

Methods: setClass, bindService, startService

	public static RCSServiceToken bindToRCSService(Activity context, ServiceConnection callback) {
		Activity realActivity = context.getParent();
		if (realActivity == null) {
			realActivity = context;
		ContextWrapper cw = new ContextWrapper(realActivity);
		cw.startService(new Intent(cw, DlnaRemouteControlService.class));
		RCSServiceBinder sb = new RCSServiceBinder(callback);
		if (cw.bindService((new Intent()).setClass(cw, DlnaRemouteControlService.class), sb, 0)) {
			sRCSConnectionMap.put(cw, sb);
			return new RCSServiceToken(cw);
		Log.e(TAG, "Failed to bind to RCS service");
		return null; 
	public static void unbindFromRCSService(RCSServiceToken token) {
		if (token == null) {
			Log.e(TAG, "Trying to unbind with RCS null token");