Share via


MediaSession.Callback.OnPrepareFromSearch(String, Bundle) Method

Definition

Override to handle requests to prepare playback from a search query.

[Android.Runtime.Register("onPrepareFromSearch", "(Ljava/lang/String;Landroid/os/Bundle;)V", "GetOnPrepareFromSearch_Ljava_lang_String_Landroid_os_Bundle_Handler", ApiSince=24)]
public virtual void OnPrepareFromSearch (string? query, Android.OS.Bundle? extras);
[<Android.Runtime.Register("onPrepareFromSearch", "(Ljava/lang/String;Landroid/os/Bundle;)V", "GetOnPrepareFromSearch_Ljava_lang_String_Landroid_os_Bundle_Handler", ApiSince=24)>]
abstract member OnPrepareFromSearch : string * Android.OS.Bundle -> unit
override this.OnPrepareFromSearch : string * Android.OS.Bundle -> unit

Parameters

query
String
extras
Bundle
Attributes

Remarks

Override to handle requests to prepare playback from a search query. An empty query indicates that the app may prepare any music. The implementation should attempt to make a smart choice about what to play. During the preparation, a session should not hold audio focus in order to allow other sessions play seamlessly. The state of playback should be updated to PlaybackState#STATE_PAUSED after the preparation is done. The playback of the prepared content should start in the implementation of #onPlay. Override #onPlayFromSearch to handle requests for starting playback without preparation.

Java documentation for android.media.session.MediaSession.Callback.onPrepareFromSearch(java.lang.String, android.os.Bundle).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to