Dela via


BroadcastReceiver.PeekService(Context, Intent) Method

Definition

Provide a binder to an already-bound service.

[Android.Runtime.Register("peekService", "(Landroid/content/Context;Landroid/content/Intent;)Landroid/os/IBinder;", "GetPeekService_Landroid_content_Context_Landroid_content_Intent_Handler")]
public virtual Android.OS.IBinder? PeekService (Android.Content.Context? myContext, Android.Content.Intent? service);
[<Android.Runtime.Register("peekService", "(Landroid/content/Context;Landroid/content/Intent;)Landroid/os/IBinder;", "GetPeekService_Landroid_content_Context_Landroid_content_Intent_Handler")>]
abstract member PeekService : Android.Content.Context * Android.Content.Intent -> Android.OS.IBinder
override this.PeekService : Android.Content.Context * Android.Content.Intent -> Android.OS.IBinder

Parameters

myContext
Context

The Context that had been passed to #onReceive(Context, Intent)

service
Intent

Identifies the already-bound service you wish to use. See android.content.Context#bindService(Intent, ServiceConnection, int) for more information.

Returns

Attributes

Remarks

Provide a binder to an already-bound service. This method is synchronous and will not start the target service if it is not present, so it is safe to call from #onReceive.

For peekService() to return a non null android.os.IBinder interface the service must have published it before. In other words some component must have called android.content.Context#bindService(Intent, ServiceConnection, int) on it.

Java documentation for android.content.BroadcastReceiver.peekService(android.content.Context, android.content.Intent).

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