WebAppManager
public
final
class
WebAppManager
extends Object
| java.lang.Object | |
| ↳ | android.content.pm.webapp.WebAppManager |
System service that manages the installation and querying of Web Apps.
This class acts as the entry point for managing Web Apps installed as Android apps.
To obtain an instance of this manager, use Context.getSystemService(Class):
WebAppManager webAppManager = context.getSystemService(WebAppManager.class);
See also:
Summary
Public methods | |
|---|---|
void
|
install(WebAppInstallRequest request, Executor executor, ObjIntConsumer<String> callback)
Requests the installation of a Web App. |
boolean
|
isAvailable()
Checks if the Web App service is available. |
void
|
query(WebAppQueryRequest request, Executor executor, IntConsumer callback)
Queries the status of a specific Web App package. |
Inherited methods | |
|---|---|
Public methods
install
public void install (WebAppInstallRequest request, Executor executor, ObjIntConsumer<String> callback)
Requests the installation of a Web App.
This operation is asynchronous. The request is processed by the system in the background, and the result is delivered via the provided callback.
| Parameters | |
|---|---|
request |
WebAppInstallRequest: The WebAppInstallRequest containing the app details (such as title and
manifest URL).
This value cannot be null. |
executor |
Executor: The Executor on which the callback will be invoked.
This value cannot be null.
Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is
used. To dispatch events through the main thread of your
application, you can use
Context.getMainExecutor().
Otherwise, provide an Executor that dispatches to an appropriate thread. |
callback |
ObjIntConsumer: The callback to receive the installation result. The String is the
package name of the installed web app. The int value is one of the result codes defined
in WebAppInstallRequest. The String will be null if the result
code is not WebAppInstallRequest.RESULT_SUCCESS. |
isAvailable
public boolean isAvailable ()
Checks if the Web App service is available.
| Returns | |
|---|---|
boolean |
true if the service is available, false otherwise. |
query
public void query (WebAppQueryRequest request, Executor executor, IntConsumer callback)
Queries the status of a specific Web App package.
This operation is asynchronous. The system checks if the package is installed by the Web App service and visible to the caller, delivering the result via the provided callback.
| Parameters | |
|---|---|
request |
WebAppQueryRequest: The WebAppQueryRequest containing the package name.
This value cannot be null. |
executor |
Executor: The Executor on which the callback will be invoked.
This value cannot be null.
Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is
used. To dispatch events through the main thread of your
application, you can use
Context.getMainExecutor().
Otherwise, provide an Executor that dispatches to an appropriate thread. |
callback |
IntConsumer: The callback to receive the query result. The int value is one of the result
codes defined in WebAppQueryRequest.
This value cannot be null. |