RemoteControlClient setTransportControlFlags - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for RemoteControlClient setTransportControlFlags method.

This code example shows how to use the following methods:setPlaybackState, setTransportControlFlags
This code example shows how to use the following methods:setTransportControlFlags
This code example shows how to use the following methods:setPlaybackState, setTransportControlFlags
		// build the PendingIntent for the remote control client 
		Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
		mediaButtonIntent.setComponent(myEventReceiver);
		PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, mediaButtonIntent, 0);
		// create and register the remote control client 
		myRemoteControlClient = new RemoteControlClient(mediaPendingIntent);
		myAudioManager.registerRemoteControlClient(myRemoteControlClient);
 
		myRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED);
		myRemoteControlClient.setTransportControlFlags(RemoteControlClient.FLAG_KEY_MEDIA_PLAY | RemoteControlClient.FLAG_KEY_MEDIA_PAUSE | RemoteControlClient.FLAG_KEY_MEDIA_STOP);
		 
		dialog = ProgressDialog.show(this, null, "曲を探しています...", true, false);
		final ContentResolver cr = this.getContentResolver();
		new Thread(new Runnable() {
			private String getWhereClause() {
				StringBuilder s = new StringBuilder();
				 
				s.append(MediaStore.Files.FileColumns.MEDIA_TYPE).append("=").append(MediaStore.Files.FileColumns.MEDIA_TYPE_NONE);
				s.append(" AND (");
				s.append("LOWER(").append(MediaStore.Files.FileColumns.DATA).append(") LIKE '%.s98'");
5
CodeRank
This code example shows how to use the following methods:setTransportControlFlags
      Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
      mediaButtonIntent.setComponent(myEventReceiver);
      // create and register the remote control client 
      PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(context, 0,
          mediaButtonIntent, 0);
      remoteControlClient = new RemoteControlClient(mediaPendingIntent);
      remoteControlClient
          .setTransportControlFlags(RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE
              | RemoteControlClient.FLAG_KEY_MEDIA_NEXT
              | RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS);
      audioManager.registerRemoteControlClient(remoteControlClient);
    } 
  } 
 
  /** 
   * Update the state of the remote control. 
   */ 
  public void updateState(boolean isPlaying) {
    if (remoteControlClient != null) {
      if (isPlaying) {
5
CodeRank
This code example shows how to use the following methods:setTransportControlFlags
		ComponentName rec = new ComponentName(m_helios.getPackageName(), RemoteControlReceiver.class.getName());
		m_audioManager.registerMediaButtonEventReceiver(rec);
		Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
		mediaButtonIntent.setComponent(rec);
		PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(m_helios.getApplicationContext(), 0, mediaButtonIntent, 0);
		m_client = new RemoteControlClient(mediaPendingIntent);
		m_audioManager.registerRemoteControlClient(m_client);
		m_client.setTransportControlFlags(RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE | RemoteControlClient.FLAG_KEY_MEDIA_NEXT | RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS);
	} 
	 
	public void play() { 
		if (m_audioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN) == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) { 
			m_client.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);
			if (hasSong()) { 
				m_currentSong.start();
				ImageButton i = (ImageButton) m_helios.findViewById(R.id.play_button);
				i.setImageResource(R.drawable.pause_selector);
			} else if (!m_nowPlaying.isEmpty() && addNextSong()) playNextSong();
		} 
	} 
4
CodeRank
setTransportControlFlags Method Overview
Sets the flags for the media transport control buttons that this client supports.
See Code Examples for other Android RemoteControlClient Methods: