Java Code Examples for android.media.RemoteControlClient#setPlaybackState()

The following examples show how to use android.media.RemoteControlClient#setPlaybackState() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: d.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public void a(boolean flag, long l1, int i1)
{
    if (m != null)
    {
        RemoteControlClient remotecontrolclient = m;
        byte byte0;
        float f1;
        if (flag)
        {
            byte0 = 3;
        } else
        {
            byte0 = 1;
        }
        if (flag)
        {
            f1 = 1.0F;
        } else
        {
            f1 = 0.0F;
        }
        remotecontrolclient.setPlaybackState(byte0, l1, f1);
        m.setTransportControlFlags(i1);
    }
}
 
Example 2
Source File: RemoteControlClientICS.java    From Popeens-DSub with GNU General Public License v3.0 6 votes vote down vote up
public void register(final Context context, final ComponentName mediaButtonReceiverComponent) {
	downloadService = (DownloadService) context;
	AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);

	// build the PendingIntent for the remote control client
	Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
	mediaButtonIntent.setComponent(mediaButtonReceiverComponent);
	PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(context.getApplicationContext(), 0, mediaButtonIntent, 0);

	// create and register the remote control client
	mRemoteControl = new RemoteControlClient(mediaPendingIntent);
	audioManager.registerRemoteControlClient(mRemoteControl);

	mRemoteControl.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED);
	mRemoteControl.setTransportControlFlags(getTransportFlags());
	imageLoader = SubsonicActivity.getStaticImageLoader(context);
}
 
Example 3
Source File: SampleMediaRouterActivity.java    From V.FlyoutTest with MIT License 6 votes vote down vote up
private void registerRCC() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        // Create the RCC and register with AudioManager and MediaRouter
        mAudioManager.requestAudioFocus(mAfChangeListener,
                AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
        mAudioManager.registerMediaButtonEventReceiver(mEventReceiver);
        mRemoteControlClient = new RemoteControlClient(mMediaPendingIntent);
        mAudioManager.registerRemoteControlClient(mRemoteControlClient);
        mMediaRouter.addRemoteControlClient(mRemoteControlClient);
        SampleMediaButtonReceiver.setActivity(SampleMediaRouterActivity.this);
        mRemoteControlClient.setTransportControlFlags(
                RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE);
        mRemoteControlClient.setPlaybackState(
                RemoteControlClient.PLAYSTATE_PLAYING);
    }
}
 
Example 4
Source File: MainActivity.java    From media-samples with Apache License 2.0 5 votes vote down vote up
private void registerRemoteControlClient() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        // Create the RCC and register with AudioManager and MediaRouter
        mAudioManager.requestAudioFocus(mAfChangeListener, AudioManager.STREAM_MUSIC,
                AudioManager.AUDIOFOCUS_GAIN);
        mAudioManager.registerMediaButtonEventReceiver(mEventReceiver);
        mRemoteControlClient = new RemoteControlClient(mMediaPendingIntent);
        mAudioManager.registerRemoteControlClient(mRemoteControlClient);
        mMediaRouter.addRemoteControlClient(mRemoteControlClient);
        SampleMediaButtonReceiver.setActivity(MainActivity.this);
        mRemoteControlClient.setTransportControlFlags(RemoteControlClient
                .FLAG_KEY_MEDIA_PLAY_PAUSE);
        mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);
    }
}
 
Example 5
Source File: MainActivity.java    From android-MediaRouter with Apache License 2.0 5 votes vote down vote up
private void registerRemoteControlClient() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        // Create the RCC and register with AudioManager and MediaRouter
        mAudioManager.requestAudioFocus(mAfChangeListener, AudioManager.STREAM_MUSIC,
                AudioManager.AUDIOFOCUS_GAIN);
        mAudioManager.registerMediaButtonEventReceiver(mEventReceiver);
        mRemoteControlClient = new RemoteControlClient(mMediaPendingIntent);
        mAudioManager.registerRemoteControlClient(mRemoteControlClient);
        mMediaRouter.addRemoteControlClient(mRemoteControlClient);
        SampleMediaButtonReceiver.setActivity(MainActivity.this);
        mRemoteControlClient.setTransportControlFlags(RemoteControlClient
                .FLAG_KEY_MEDIA_PLAY_PAUSE);
        mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);
    }
}