LocationButtonProvider
public
interface
LocationButtonProvider
| android.app.permissionui.LocationButtonProvider |
The primary entry point for the Location Button API.
This interface allows an application to request a system-rendered button that, when tapped, grants the app temporary/one-time permission to access the user's precise location. It provides a trusted and standardized way for users to share their location for a specific task.
Instances of this interface are obtained from LocationButtonProviderFactory.
Summary
Public methods | |
|---|---|
abstract
void
|
openSession(Activity activity, IBinder hostToken, int displayId, LocationButtonRequest request, Executor clientExecutor, LocationButtonClient client)
Asynchronously requests a new Location Button session. |
Public methods
openSession
public abstract void openSession (Activity activity, IBinder hostToken, int displayId, LocationButtonRequest request, Executor clientExecutor, LocationButtonClient client)
Asynchronously requests a new Location Button session.
This method initiates a request to the system to create a location button. The button's UI is rendered in a separate process and embedded within the application's view hierarchy. User interaction with the button is handled securely by the system.
The outcome of this request, including the created LocationButtonSession or any
errors, is delivered asynchronously to the provided LocationButtonClient.
| Parameters | |
|---|---|
activity |
Activity: Host app activity which launch permission activity in its task.
This value cannot be null. |
hostToken |
IBinder: A token for the host window.
This value cannot be null. |
displayId |
int: The ID of the display where the button will appear. |
request |
LocationButtonRequest: A LocationButtonRequest defining the button's appearance.
This value cannot be null. |
clientExecutor |
Executor: The Executor on which to invoke all client callbacks.
This value cannot be null. |
client |
LocationButtonClient: The LocationButtonClient to receive session events and results.
This value cannot be null. |