MockContext.RegisterReceiver 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
| Name | Description |
|---|---|
| RegisterReceiver(BroadcastReceiver, IntentFilter, String, Handler, ActivityFlags) |
Obsolete.
Throws UnsupportedOperationException. Override this method to register a broadcast receiver in a test. |
| RegisterReceiver(BroadcastReceiver, IntentFilter, String, Handler) |
Register to receive intent broadcasts, to run in the context of <var>scheduler</var>. |
| RegisterReceiver(BroadcastReceiver, IntentFilter) |
Register a BroadcastReceiver to be run in the main activity thread. |
| RegisterReceiver(BroadcastReceiver, IntentFilter, ActivityFlags) |
Obsolete.
Throws UnsupportedOperationException. Override this method to register a broadcast receiver in a test. |
RegisterReceiver(BroadcastReceiver, IntentFilter, String, Handler, ActivityFlags)
Caution
This method has an incorrect enumeration type. Use the overload that takes ReceiverFlags instead.
Throws UnsupportedOperationException. Override this method to register a broadcast receiver in a test.
[Android.Runtime.Register("registerReceiver", "(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;Ljava/lang/String;Landroid/os/Handler;I)Landroid/content/Intent;", "GetRegisterReceiver_Landroid_content_BroadcastReceiver_Landroid_content_IntentFilter_Ljava_lang_String_Landroid_os_Handler_IHandler", ApiSince=26)]
[System.Obsolete("This method has an incorrect enumeration type. Use the overload that takes ReceiverFlags instead.")]
public override Android.Content.Intent? RegisterReceiver(Android.Content.BroadcastReceiver? receiver, Android.Content.IntentFilter? filter, string? broadcastPermission, Android.OS.Handler? scheduler, Android.Content.ActivityFlags flags);
[<Android.Runtime.Register("registerReceiver", "(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;Ljava/lang/String;Landroid/os/Handler;I)Landroid/content/Intent;", "GetRegisterReceiver_Landroid_content_BroadcastReceiver_Landroid_content_IntentFilter_Ljava_lang_String_Landroid_os_Handler_IHandler", ApiSince=26)>]
[<System.Obsolete("This method has an incorrect enumeration type. Use the overload that takes ReceiverFlags instead.")>]
override this.RegisterReceiver : Android.Content.BroadcastReceiver * Android.Content.IntentFilter * string * Android.OS.Handler * Android.Content.ActivityFlags -> Android.Content.Intent
Parameters
- receiver
- BroadcastReceiver
The broadcast receiver to register. Available to a test override; the default mock implementation does not use this argument.
- filter
- IntentFilter
The intent filter for the receiver. Available to a test override; the default mock implementation does not use this argument.
- broadcastPermission
- String
The permission required of broadcast senders. Available to a test override; the default mock implementation does not use this argument.
- scheduler
- Handler
The handler for receiver callbacks. Available to a test override; the default mock implementation does not use this argument.
- flags
- ActivityFlags
The flags for the requested operation. Available to a test override; the default mock implementation does not use this argument.
Returns
No value is returned. The default mock implementation throws UnsupportedOperationException; override this method to supply a test result.
- Attributes
Remarks
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
RegisterReceiver(BroadcastReceiver, IntentFilter, String, Handler)
Register to receive intent broadcasts, to run in the context of <var>scheduler</var>.
[Android.Runtime.Register("registerReceiver", "(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;Ljava/lang/String;Landroid/os/Handler;)Landroid/content/Intent;", "GetRegisterReceiver_Landroid_content_BroadcastReceiver_Landroid_content_IntentFilter_Ljava_lang_String_Landroid_os_Handler_Handler")]
public override Android.Content.Intent? RegisterReceiver(Android.Content.BroadcastReceiver? receiver, Android.Content.IntentFilter? filter, string? broadcastPermission, Android.OS.Handler? scheduler);
[<Android.Runtime.Register("registerReceiver", "(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;Ljava/lang/String;Landroid/os/Handler;)Landroid/content/Intent;", "GetRegisterReceiver_Landroid_content_BroadcastReceiver_Landroid_content_IntentFilter_Ljava_lang_String_Landroid_os_Handler_Handler")>]
override this.RegisterReceiver : Android.Content.BroadcastReceiver * Android.Content.IntentFilter * string * Android.OS.Handler -> Android.Content.Intent
Parameters
- receiver
- BroadcastReceiver
The BroadcastReceiver to handle the broadcast.
- filter
- IntentFilter
Selects the Intent broadcasts to be received.
- broadcastPermission
- String
String naming a permissions that a broadcaster must hold in order to send an Intent to you. If null, no permission is required.
- scheduler
- Handler
Handler identifying the thread that will receive the Intent. If null, the main thread of the process will be used.
Returns
No value is returned. The default mock implementation throws UnsupportedOperationException; override this method to supply a test result.
- Attributes
Remarks
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
RegisterReceiver(BroadcastReceiver, IntentFilter)
Register a BroadcastReceiver to be run in the main activity thread.
[Android.Runtime.Register("registerReceiver", "(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;", "GetRegisterReceiver_Landroid_content_BroadcastReceiver_Landroid_content_IntentFilter_Handler")]
public override Android.Content.Intent? RegisterReceiver(Android.Content.BroadcastReceiver? receiver, Android.Content.IntentFilter? filter);
[<Android.Runtime.Register("registerReceiver", "(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;", "GetRegisterReceiver_Landroid_content_BroadcastReceiver_Landroid_content_IntentFilter_Handler")>]
override this.RegisterReceiver : Android.Content.BroadcastReceiver * Android.Content.IntentFilter -> Android.Content.Intent
Parameters
- receiver
- BroadcastReceiver
The BroadcastReceiver to handle the broadcast.
- filter
- IntentFilter
Selects the Intent broadcasts to be received.
Returns
No value is returned. The default mock implementation throws UnsupportedOperationException; override this method to supply a test result.
- Attributes
Remarks
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
RegisterReceiver(BroadcastReceiver, IntentFilter, ActivityFlags)
Caution
This method has an incorrect enumeration type. Use the overload that takes ReceiverFlags instead.
Throws UnsupportedOperationException. Override this method to register a broadcast receiver in a test.
[Android.Runtime.Register("registerReceiver", "(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;I)Landroid/content/Intent;", "GetRegisterReceiver_Landroid_content_BroadcastReceiver_Landroid_content_IntentFilter_IHandler", ApiSince=26)]
[System.Obsolete("This method has an incorrect enumeration type. Use the overload that takes ReceiverFlags instead.")]
public override Android.Content.Intent? RegisterReceiver(Android.Content.BroadcastReceiver? receiver, Android.Content.IntentFilter? filter, Android.Content.ActivityFlags flags);
[<Android.Runtime.Register("registerReceiver", "(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;I)Landroid/content/Intent;", "GetRegisterReceiver_Landroid_content_BroadcastReceiver_Landroid_content_IntentFilter_IHandler", ApiSince=26)>]
[<System.Obsolete("This method has an incorrect enumeration type. Use the overload that takes ReceiverFlags instead.")>]
override this.RegisterReceiver : Android.Content.BroadcastReceiver * Android.Content.IntentFilter * Android.Content.ActivityFlags -> Android.Content.Intent
Parameters
- receiver
- BroadcastReceiver
The broadcast receiver to register. Available to a test override; the default mock implementation does not use this argument.
- filter
- IntentFilter
The intent filter for the receiver. Available to a test override; the default mock implementation does not use this argument.
- flags
- ActivityFlags
The flags for the requested operation. Available to a test override; the default mock implementation does not use this argument.
Returns
No value is returned. The default mock implementation throws UnsupportedOperationException; override this method to supply a test result.
- Attributes
Remarks
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.