語言

BroadcastReceiver.PeekService(Context, Intent) 方法

定義

提供一份已綁定的服務資料夾。

[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

參數

myContext
Context

被傳達給的情境 #onReceive(Context, Intent)

service
Intent

識別你已綁定的服務。 請參閱 android.content.Context#bindService(Intent, ServiceConnection, int) 欲了解更多資訊。

傳回

提供一份已綁定的服務資料夾。 此方法為同步式,若目標服務不存在則不會啟動,因此從 onReceive(Context, Intent) 呼叫是安全的。 peekService() 若要回傳非空的 IBinder 介面,該服務必須先發布該介面。 換句話說,某個元件必須呼叫 android.content.Context.bindService(Intent, ServiceConnection, int) 在上面。

屬性

備註

提供一份已綁定的服務資料夾。 此方法為同步式,若目標服務不存在則不會啟動,因此從 中呼叫 #onReceive是安全的。

peekService() 要回傳非空 android.os.IBinder 介面,必須是該服務先前已發布該介面。 換句話說,一定有某個元件呼叫 android.content.Context#bindService(Intent, ServiceConnection, int) 了它。

Java 文件 android.content.BroadcastReceiver.peekService(android.content.Context, android.content.Intent)。

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於