Code example for RemoteControlClient

Methods: unregisterRemoteControlClient

0
		getAudioManager().registerRemoteControlClient(getRemoteControlClient());
	} 
 
	@Override 
	public void onPlaybackStopped() { 
		getAudioManager().unregisterRemoteControlClient(
				getRemoteControlClient()); 
	} 
 
	@Override 
	public void onTitleChanged(String title) {
		getRemoteControlClient().editMetadata(false)
				.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, title)
				.apply();
	} 
 
	@Override 
	public void onArtistChanged(String artist) {
		getRemoteControlClient().editMetadata(false)
				.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, artist)
				.apply();
	} 
 
	@Override 
	public void onAlbumArtChanged(int resourceId) {
		// TODO Auto-generated method stub 
 
	} 
 
	@Override 
	public void onAlbumArtChangedToUri(Uri url) {
		// TODO Auto-generated method stub 
 
	} 
 
	private RemoteControlClient getRemoteControlClient() {
		if (mRemoteControlClient == null) {
			ComponentName eventReciever = new ComponentName(mContext,
					BroadcastReceiver.class);
			Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
			mediaButtonIntent.setComponent(eventReciever);
			PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext,
					0, mediaButtonIntent, 0);
			mRemoteControlClient = new RemoteControlClient(pendingIntent);
			mRemoteControlClient.setTransportControlFlags(getTCFs());
		} 
		return mRemoteControlClient;
	}