我的目的是允许用户在锁定屏幕上显示图片。我能轻松找到的唯一方法是通过RemoteControlClient
. 我的问题是锁定屏幕上的图像相当暗,我想知道是否有设置使它更亮。我设置它的代码如下:
private void setUpRemoteController() {
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
audioManager.requestAudioFocus(new AudioFocusListener(), AudioManager.STREAM_MUSIC,
AudioManager.AUDIOFOCUS_GAIN);
ComponentName pareceiver = new ComponentName(this, PAReceiver.class.getName());
audioManager.registerMediaButtonEventReceiver(pareceiver);
Intent mediaButtonIntent = new Intent(android.content.Intent.ACTION_MEDIA_BUTTON);
mediaButtonIntent.setComponent(pareceiver);
PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(this,
0,mediaButtonIntent,0);
remoteControlClient = new RemoteControlClient(mediaPendingIntent);
remoteControlClient.setPlaybackState(
RemoteControlClient.PLAYSTATE_PLAYING);
remoteControlClient.setTransportControlFlags(
RemoteControlClient.FLAG_KEY_MEDIA_NEXT |
RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS);
audioManager.registerRemoteControlClient(remoteControlClient);
Log.d("", "Started and set up controller and receiver");
}
RemoteControlClient
在相关说明中:当我实际上不需要它时,是否有任何方法可以在不劫持音频焦点的情况下进行显示?