belongs to Maven artifact com.android.support:customtabs:28.0.0-alpha1
PostMessageServiceConnection
public
abstract
class
PostMessageServiceConnection
extends Object
implements
ServiceConnection
java.lang.Object | |
↳ | android.support.customtabs.PostMessageServiceConnection |
A ServiceConnection
for Custom Tabs providers to use while connecting to a
PostMessageService
on the client side.
Summary
Public constructors | |
---|---|
PostMessageServiceConnection(CustomTabsSessionToken session)
|
Public methods | |
---|---|
boolean
|
bindSessionToPostMessageService(Context context, String packageName)
Binds the browser side to the client app through the given |
final
boolean
|
notifyMessageChannelReady(Bundle extras)
Notifies the client that the postMessage channel requested with
|
void
|
onPostMessageServiceConnected()
Called when the |
void
|
onPostMessageServiceDisconnected()
Called when the connection is lost with the |
final
void
|
onServiceConnected(ComponentName name, IBinder service)
|
final
void
|
onServiceDisconnected(ComponentName name)
|
final
boolean
|
postMessage(String message, Bundle extras)
Posts a message to the client. |
void
|
unbindFromContext(Context context)
Unbinds this service connection from the given context. |
Inherited methods | |
---|---|
From
class
java.lang.Object
| |
From
interface
android.content.ServiceConnection
|
Public constructors
PostMessageServiceConnection
PostMessageServiceConnection (CustomTabsSessionToken session)
Parameters | |
---|---|
session |
CustomTabsSessionToken |
Public methods
bindSessionToPostMessageService
boolean bindSessionToPostMessageService (Context context, String packageName)
Binds the browser side to the client app through the given PostMessageService
name.
After this, this PostMessageServiceConnection
can be used for sending postMessage
related communication back to the client.
Parameters | |
---|---|
context |
Context : A context to bind to the service. |
packageName |
String : The name of the package to be bound to. |
Returns | |
---|---|
boolean |
Whether the binding was successful. |
notifyMessageChannelReady
boolean notifyMessageChannelReady (Bundle extras)
Notifies the client that the postMessage channel requested with
requestPostMessageChannel(CustomTabsSessionToken, android.net.Uri)
is ready. This method should be
called when the browser binds to the client side PostMessageService
and also readies
a connection to the web frame.
Parameters | |
---|---|
extras |
Bundle : Reserved for future use. |
Returns | |
---|---|
boolean |
Whether the notification was sent to the remote successfully. |
onPostMessageServiceConnected
void onPostMessageServiceConnected ()
Called when the PostMessageService
connection is established.
onPostMessageServiceDisconnected
void onPostMessageServiceDisconnected ()
Called when the connection is lost with the PostMessageService
.
onServiceConnected
void onServiceConnected (ComponentName name, IBinder service)
Parameters | |
---|---|
name |
ComponentName |
service |
IBinder |
onServiceDisconnected
void onServiceDisconnected (ComponentName name)
Parameters | |
---|---|
name |
ComponentName |
postMessage
boolean postMessage (String message, Bundle extras)
Posts a message to the client. This should be called when a tab controlled by related
CustomTabsSession
has sent a postMessage. If postMessage() is called from a single
thread, then the messages will be posted in the same order.
Parameters | |
---|---|
message |
String : The message sent. |
extras |
Bundle : Reserved for future use. |
Returns | |
---|---|
boolean |
Whether the postMessage was sent to the remote successfully. |
unbindFromContext
void unbindFromContext (Context context)
Unbinds this service connection from the given context.
Parameters | |
---|---|
context |
Context : The context to be unbound from.
|
Annotations
Classes
- CustomTabsCallback
- CustomTabsClient
- CustomTabsIntent
- CustomTabsIntent.Builder
- CustomTabsService
- CustomTabsServiceConnection
- CustomTabsSession
- CustomTabsSessionToken
- PostMessageService
- PostMessageServiceConnection
- R
- R.anim
- R.attr
- R.bool
- R.color
- R.dimen
- R.drawable
- R.id
- R.integer
- R.layout
- R.string
- R.style
- R.styleable
- TrustedWebUtils