-
- All Implemented Interfaces:
-
java.io.Serializable
public final class AndroidComponentAddress extends SocketAddress
The target of an Android android.app.Service binding.
Consists of an explicit Intent that identifies an android.os.IBinder returned by some Service's onBind method. You can specify that Service by ComponentName or let Android resolve it using the Intent's other fields (package, action, data URI, type and category set). See Bound Services Overviewand Intents and Intent Filters for more.
For convenience in the common case where a android.app.Service exposes just one IPC interface, we provide default values for the binding Intent fields, namely, an action of ACTION_BIND, an empty category set and null type and data URI.
The semantics of equals are the same as filterEquals.
-
-
Method Summary
Modifier and Type Method Description static AndroidComponentAddressforContext(Context context)Creates an address for the given android.app.Service instance with the default binding Intent. static AndroidComponentAddressforLocalComponent(Context context, Class<out Object> cls)Creates an address referencing a android.app.Service hosted by this application andusing the default binding Intent. static AndroidComponentAddressforRemoteComponent(String applicationPackage, String serviceClassName)Creates an address referencing a android.app.Service in anotherapplication and using the default binding Intent. static AndroidComponentAddressforBindIntent(Intent intent)Creates a new address that uses the "filter matching" fields of intentas thebinding Intent.static AndroidComponentAddressforComponent(ComponentName component)Creates an address referencing the specified android.app.Service component and usingthe default binding Intent. StringgetAuthority()Returns the Authority which is the package name of the target app. StringgetPackage()Returns the package target of the wrapped Intent, either from its package restrictionor, if not present, its fully qualified ComponentName. ComponentNamegetComponent()Returns the ComponentName of this binding Intent, or null if one isn't set. IntentasBindIntent()Returns this address as an explicit Intent suitable for passing to . StringasAndroidAppUri()Returns this address as an "android-app://" uri. inthashCode()booleanequals(Object obj)StringtoString()-
-
Method Detail
-
forContext
static AndroidComponentAddress forContext(Context context)
Creates an address for the given android.app.Service instance with the default binding Intent.
-
forLocalComponent
static AndroidComponentAddress forLocalComponent(Context context, Class<out Object> cls)
Creates an address referencing a android.app.Service hosted by this application andusing the default binding Intent.
-
forRemoteComponent
static AndroidComponentAddress forRemoteComponent(String applicationPackage, String serviceClassName)
Creates an address referencing a android.app.Service in anotherapplication and using the default binding Intent.
- Parameters:
applicationPackage- The package name of the application containing the server.serviceClassName- The full class name of the Android Service to bind to.
-
forBindIntent
static AndroidComponentAddress forBindIntent(Intent intent)
Creates a new address that uses the "filter matching" fields of
intentas thebinding Intent.intentmust be "explicit", i.e. having either a target component () or package restriction (getPackage). See Intents and IntentFilters for more.A multi-tenant android.app.Service can call this from its method to locate an appropriate io.grpc.Server bylistening address.
-
forComponent
static AndroidComponentAddress forComponent(ComponentName component)
Creates an address referencing the specified android.app.Service component and usingthe default binding Intent.
-
getAuthority
String getAuthority()
Returns the Authority which is the package name of the target app.
See android.content.ComponentName and getPackage.
-
getPackage
String getPackage()
Returns the package target of the wrapped Intent, either from its package restrictionor, if not present, its fully qualified ComponentName.
-
getComponent
@Nullable() ComponentName getComponent()
Returns the ComponentName of this binding Intent, or null if one isn't set.
-
asBindIntent
Intent asBindIntent()
Returns this address as an explicit Intent suitable for passing to .
-
asAndroidAppUri
String asAndroidAppUri()
Returns this address as an "android-app://" uri.
See URI_ANDROID_APP_SCHEME for details.
-
hashCode
int hashCode()
-
-
-
-