CustomTabsClient
public class CustomTabsClient
extends Object
Class to communicate with a CustomTabsService
and create CustomTabsSession
from it.
Summary
Inherited methods |
From class java.lang.Object
Object |
clone() Creates and returns a copy of this object. |
boolean |
equals(Object obj) Indicates whether some other object is "equal to" this one. |
void |
finalize() Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |
final Class<?> |
getClass() Returns the runtime class of this Object . |
int |
hashCode() Returns a hash code value for the object. |
final void |
notify() Wakes up a single thread that is waiting on this object's monitor. |
final void |
notifyAll() Wakes up all threads that are waiting on this object's monitor. |
String |
toString() Returns a string representation of the object. |
final void |
wait(long millis, int nanos) Causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed. |
final void |
wait(long millis) Causes the current thread to wait until either another thread invokes the notify() method or the notifyAll() method for this object, or a specified amount of time has elapsed. |
final void |
wait() Causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object. |
|
Public methods
connectAndInitialize
boolean connectAndInitialize (Context context,
String packageName)
Connects to the Custom Tabs warmup service, and initializes the browser. This convenience method connects to the service, and immediately warms up the Custom Tabs implementation. Since service connection is asynchronous, the return code is not the return code of warmup. This call is optional, and clients are encouraged to connect to the service, call warmup()
and create a session. In this case, calling this method is not necessary.
Parameters |
context |
Context : Context to use to connect to the remote service. |
packageName |
String : Package name of the target implamentation. |
Returns |
boolean |
Whether the binding was successful. |
extraCommand
Bundle extraCommand (String commandName,
Bundle args)
Parameters |
commandName |
String
|
args |
Bundle
|
getPackageName
String getPackageName (Context context,
List<String> packages)
Returns the preferred package to use for Custom Tabs, preferring the default VIEW handler.
Parameters |
context |
Context
|
packages |
List
|
getPackageName
String getPackageName (Context context,
List<String> packages,
boolean ignoreDefault)
Returns the preferred package to use for Custom Tabs. The preferred package name is the default VIEW intent handler as long as it supports Custom Tabs. To modify this preferred behavior, set ignoreDefault
to true and give a non empty list of package names in packages
.
Parameters |
context |
Context : Context to use for querying the packages. |
packages |
List : Ordered list of packages to test for Custom Tabs support, in decreasing order of priority. |
ignoreDefault |
boolean : If set, the default VIEW handler won't get priority over other browsers. |
Returns |
String |
The preferred package name for handling Custom Tabs, or null . |
newSession
CustomTabsSession newSession (CustomTabsCallback callback)
Creates a new session through an ICustomTabsService with the optional callback. This session can be used to associate any related communication through the service with an intent and then later with a Custom Tab. The client can then send later service calls or intents to through same session-intent-Custom Tab association.
Parameters |
callback |
CustomTabsCallback : The callback through which the client will receive updates about the created session. Can be null. |
warmup
boolean warmup (long flags)
Warm up the browser process. Allows the browser application to pre-initialize itself in the background. Significantly speeds up URL opening in the browser. This is asynchronous and can be called several times.
Parameters |
flags |
long : Reserved for future use. |
Returns |
boolean |
Whether the warmup was successful. |