@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/8022")
public class AndroidComponentAddress
extends java.net.SocketAddress
Service binding.
Consists of a ComponentName reference to the Service and the action, data URI, type,
and category set for an Intent used to bind to it. All together, these fields identify
the IBinder that would be returned by some implementation of Service.onBind(Intent). Indeed, the semantics of equals(Object) match
Android's internal equivalence relation for caching the result of calling this method. See Bound Services Overview
for more.
For convenience in the common case where a Service exposes just one IBinder IPC interface, we provide default values for the binding Intent
fields, namely, an action of ApiConstants.ACTION_BIND, an empty category set and null
type and data URI.
| Modifier | Constructor and Description |
|---|---|
protected |
AndroidComponentAddress(android.content.Intent bindIntent) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
asAndroidAppUri()
Returns this address as an "android-app://" uri.
|
android.content.Intent |
asBindIntent()
Returns this address as an explicit
Intent suitable for passing to Context.bindService(android.content.Intent, android.content.ServiceConnection, int). |
boolean |
equals(java.lang.Object obj) |
static AndroidComponentAddress |
forBindIntent(android.content.Intent intent)
Creates a new address that refers to
intent's component and that uses the "filter
matching" fields of intent as the binding Intent. |
static AndroidComponentAddress |
forComponent(android.content.ComponentName component)
Creates an address referencing the specified
Service component and using
the default binding Intent. |
static AndroidComponentAddress |
forContext(android.content.Context context)
Creates an address for the given
Service instance with the default binding
Intent. |
static AndroidComponentAddress |
forLocalComponent(android.content.Context context,
java.lang.Class<?> cls)
Creates an address referencing a
Service hosted by this application and
using the default binding Intent. |
static AndroidComponentAddress |
forRemoteComponent(java.lang.String applicationPackage,
java.lang.String serviceClassName)
Creates an address referencing a
Service in another
application and using the default binding Intent. |
java.lang.String |
getAuthority() |
android.content.ComponentName |
getComponent() |
int |
hashCode() |
java.lang.String |
toString() |
protected AndroidComponentAddress(android.content.Intent bindIntent)
public static AndroidComponentAddress forContext(android.content.Context context)
Service instance with the default binding
Intent.public static AndroidComponentAddress forLocalComponent(android.content.Context context, java.lang.Class<?> cls)
Service hosted by this application and
using the default binding Intent.public static AndroidComponentAddress forRemoteComponent(java.lang.String applicationPackage, java.lang.String serviceClassName)
Service in another
application and using the default binding Intent.applicationPackage - The package name of the application containing the server.serviceClassName - The full class name of the Android Service to bind to.public static AndroidComponentAddress forBindIntent(android.content.Intent intent)
intent's component and that uses the "filter
matching" fields of intent as the binding Intent.
A multi-tenant Service can call this from its Service.onBind(Intent) method to locate an appropriate Server by
listening address.
java.lang.IllegalArgumentException - if intent's component is nullpublic static AndroidComponentAddress forComponent(android.content.ComponentName component)
Service component and using
the default binding Intent.public java.lang.String getAuthority()
public android.content.ComponentName getComponent()
public android.content.Intent asBindIntent()
Intent suitable for passing to Context.bindService(android.content.Intent, android.content.ServiceConnection, int).public java.lang.String asAndroidAppUri()
See Intent.URI_ANDROID_APP_SCHEME for details.
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object