Code example for ContextWrapper

Methods: bindServicestartService

0
		return bindToService(context, null);
	} 
 
	public static ServiceToken bindToService(Context context, ServiceConnection callback) {
 
		ContextWrapper cw = new ContextWrapper(context);
		cw.startService(new Intent(cw, MusicPlaybackService.class));
		ServiceBinder sb = new ServiceBinder(callback);
		if (cw.bindService(new Intent(cw, MusicPlaybackService.class), sb, 0)) {
			sConnectionMap.put(cw, sb);
			return new ServiceToken(cw);
		} 
		Log.e("Music", "Failed to bind to service");
		return null; 
	} 
 
	public static void unbindFromService(ServiceToken token) {
 
		if (token == null) {
			Log.e(LOGTAG, "Trying to unbind with null token");
Stop searching for code, let great code find you!  Add Codota to your java IDE