CloudMediaProvider.OnSearchMedia Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
OnSearchMedia(String, Bundle, CancellationSignal) |
Searches media items based on entered search text, managed by |
OnSearchMedia(String, String, Bundle, CancellationSignal) |
Searches media items based on a selected suggestion, managed by |
OnSearchMedia(String, Bundle, CancellationSignal)
Searches media items based on entered search text, managed by extras
and
returns a cursor of CloudMediaProviderContract.MediaColumns
based on the match.
[Android.Runtime.Register("onSearchMedia", "(Ljava/lang/String;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/database/Cursor;", "GetOnSearchMedia_Ljava_lang_String_Landroid_os_Bundle_Landroid_os_CancellationSignal_Handler", ApiSince=36)]
public virtual Android.Database.ICursor OnSearchMedia(string searchText, Android.OS.Bundle extras, Android.OS.CancellationSignal? cancellationSignal);
[<Android.Runtime.Register("onSearchMedia", "(Ljava/lang/String;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/database/Cursor;", "GetOnSearchMedia_Ljava_lang_String_Landroid_os_Bundle_Landroid_os_CancellationSignal_Handler", ApiSince=36)>]
abstract member OnSearchMedia : string * Android.OS.Bundle * Android.OS.CancellationSignal -> Android.Database.ICursor
override this.OnSearchMedia : string * Android.OS.Bundle * Android.OS.CancellationSignal -> Android.Database.ICursor
Parameters
- searchText
- String
search text to be used.
- extras
- Bundle
containing keys to manage the search results:
<ul>
<li> CloudMediaProviderContract#EXTRA_PAGE_TOKEN
<li> CloudMediaProviderContract#EXTRA_PAGE_SIZE
<li> CloudMediaProviderContract#EXTRA_SORT_ORDER
<li> android.content.Intent#EXTRA_MIME_TYPES
</ul>
- cancellationSignal
- CancellationSignal
CancellationSignal
to check if request has been cancelled.
Returns
cursor of CloudMediaProviderContract.MediaColumns
based on the match.
- Attributes
Remarks
Searches media items based on entered search text, managed by extras
and returns a cursor of CloudMediaProviderContract.MediaColumns
based on the match.
The cloud media provider must set the CloudMediaProviderContract#EXTRA_MEDIA_COLLECTION_ID
as part of the returned cursor by using Cursor#setExtras
. Not setting this is an error and invalidates the returned Cursor
, meaning photo picker will not use the cursor for any operation.
extras
may contain some key-value pairs which should be used to prepare the results. If the provider handled any params in extras
, it must add the key to the ContentResolver#EXTRA_HONORED_ARGS
as part of the returned cursor by using Cursor#setExtras
. If not honored, photo picker will assume the result of the query is without the extra being used.
An example user journey: <ol> <li>User enters the search prompt.</li> <li>Using #onQuerySearchSuggestions
, photo picker display suggestions as the user keeps typing.</li> <li>User types completely and then enters search, Photo picker calls: onSearchMedia(searchText, extras)
</li> </ol>
If the cloud media provider supports pagination, they can set CloudMediaProviderContract#EXTRA_PAGE_TOKEN
as the next page token, as part of the returned cursor by using Cursor#setExtras
. If a token is set, the OS will pass it as a key value pair in extras
when querying for search media for subsequent pages. The provider can keep returning pagination tokens in the returned cursor by using Cursor#setExtras
until the last page at which point it should not set a token in the returned cursor.
Results may not be displayed if it takes longer than 3 seconds to get a paged response from the cloud media provider.
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
OnSearchMedia(String, String, Bundle, CancellationSignal)
Searches media items based on a selected suggestion, managed by extras
and
returns a cursor of CloudMediaProviderContract.MediaColumns
based on the match.
[Android.Runtime.Register("onSearchMedia", "(Ljava/lang/String;Ljava/lang/String;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/database/Cursor;", "GetOnSearchMedia_Ljava_lang_String_Ljava_lang_String_Landroid_os_Bundle_Landroid_os_CancellationSignal_Handler", ApiSince=36)]
public virtual Android.Database.ICursor OnSearchMedia(string suggestedMediaSetId, string? fallbackSearchText, Android.OS.Bundle extras, Android.OS.CancellationSignal? cancellationSignal);
[<Android.Runtime.Register("onSearchMedia", "(Ljava/lang/String;Ljava/lang/String;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/database/Cursor;", "GetOnSearchMedia_Ljava_lang_String_Ljava_lang_String_Landroid_os_Bundle_Landroid_os_CancellationSignal_Handler", ApiSince=36)>]
abstract member OnSearchMedia : string * string * Android.OS.Bundle * Android.OS.CancellationSignal -> Android.Database.ICursor
override this.OnSearchMedia : string * string * Android.OS.Bundle * Android.OS.CancellationSignal -> Android.Database.ICursor
Parameters
- suggestedMediaSetId
- String
the media set ID of the suggestion that the user wants to search.
- fallbackSearchText
- String
optional search text to be used when suggestedMediaSetId
is not useful.
- extras
- Bundle
containing keys to manage the search results:
<ul>
<li>CloudMediaProviderContract#EXTRA_PAGE_TOKEN
<li>CloudMediaProviderContract#EXTRA_PAGE_SIZE
<li>CloudMediaProviderContract#EXTRA_SORT_ORDER
<li> android.content.Intent#EXTRA_MIME_TYPES
</ul>
- cancellationSignal
- CancellationSignal
CancellationSignal
to check if request has been cancelled.
Returns
cursor of CloudMediaProviderContract.MediaColumns
based on the match.
- Attributes
Remarks
Searches media items based on a selected suggestion, managed by extras
and returns a cursor of CloudMediaProviderContract.MediaColumns
based on the match.
The cloud media provider must set the CloudMediaProviderContract#EXTRA_MEDIA_COLLECTION_ID
as part of the returned cursor by using Cursor#setExtras
. Not setting this is an error and invalidates the returned Cursor
, meaning photo picker will not use the cursor for any operation.
extras
may contain some key-value pairs which should be used to prepare the results. If the provider handled any params in extras
, it must add the key to the ContentResolver#EXTRA_HONORED_ARGS
as part of the returned cursor by using Cursor#setExtras
. If not honored, photo picker will assume the result of the query is without the extra being used.
An example user journey: <ol> <li>User enters the search prompt.</li> <li>Using #onQuerySearchSuggestions
, photo picker display suggestions as the user keeps typing.</li> <li>User selects a suggestion, Photo picker calls: onSearchMedia(suggestedMediaSetId, fallbackSearchText, extras)
with the suggestedMediaSetId
corresponding to the user chosen suggestion. CloudMediaProviderContract.SearchSuggestionColumns#MEDIA_SET_ID
</li> </ol>
If the cloud media provider supports pagination, they can set CloudMediaProviderContract#EXTRA_PAGE_TOKEN
as the next page token, as part of the returned cursor by using Cursor#setExtras
. If a token is set, the OS will pass it as a key value pair in extras
when querying for search media for subsequent pages. The provider can keep returning pagination tokens in the returned cursor by using Cursor#setExtras
until the last page at which point it should not set a token in the returned cursor
Results may not be displayed if it takes longer than 3 seconds to get a paged response from the cloud media provider.
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.