Share via


NotificationManager.MatchesCallFilter(Uri) Method

Definition

Returns whether a call from the provided URI is permitted to notify the user.

[Android.Runtime.Register("matchesCallFilter", "(Landroid/net/Uri;)Z", "GetMatchesCallFilter_Landroid_net_Uri_Handler", ApiSince=33)]
public virtual bool MatchesCallFilter (Android.Net.Uri uri);
[<Android.Runtime.Register("matchesCallFilter", "(Landroid/net/Uri;)Z", "GetMatchesCallFilter_Landroid_net_Uri_Handler", ApiSince=33)>]
abstract member MatchesCallFilter : Android.Net.Uri -> bool
override this.MatchesCallFilter : Android.Net.Uri -> bool

Parameters

uri
Uri

A URI representing a caller. Must not be null.

Returns

A boolean indicating whether a call from the URI provided would be allowed to interrupt the user given the current filter.

Attributes

Remarks

Returns whether a call from the provided URI is permitted to notify the user.

A true return value indicates one of the following: Do Not Disturb is not currently active; or the caller is a repeat caller and the current policy allows interruptions from repeat callers; or the caller is in the user's set of contacts whose calls are allowed to interrupt Do Not Disturb.

If Do Not Disturb is enabled and either no interruptions or only alarms are allowed, this method will return false regardless of input.

The provided URI should be a tel: or mailto: schema URI indicating the source of the call. For an accurate answer regarding whether the caller matches the user's permitted contacts, the path part of the URI must match an entry the Contacts database in the appropriate column.

Passing in a android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI is also permissible, but should only be used for priority contact interruptions and may not provide accurate results in the case of repeat callers.

See also Person.Builder#setUri and android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI for more information.

Callers of this method must have notification listener access, permission to read contacts, or have system permissions.

NOTE: This method calls into Contacts, which may take some time, and should not be called on the main thread.

Java documentation for android.app.NotificationManager.matchesCallFilter(android.net.Uri).

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