我的目的是允许用户在锁定屏幕上显示图片。我能找到的唯一方法是通过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
显示出来?