You can integrate Google Meet Live Sharing SDK into your Android app using Java.
You can find Android documentation and additional Android libraries to expand the features of your app through the official Android Developers Documentation.
Use the SDK
To use the Meet Live Sharing SDK, call the
AddonClientFactory.getClient
method. This returns an
AddonClient
that serves as the entry point for the co-activities.
Java
public ListenableFuture<AddonSession> initialSetup() {
AddonClient meetClient = AddonClientFactory.getClient();
return meetClient;
}
Get the Co-Doing and Co-Watching clients
To use the client, call the
newSessionBuilder
method from the AddonClient
to return a builder for a new
AddonSession
.
To begin a session, add the
withCoDoing
method, the
withCoWatching
method, or both onto the builder.
For more information on how to start a co-watching or a co-doing activity, see these guides:
The Co-Watching API and Co-Doing API are independent and can be used in parallel with each other. You can also start an add-on session without using the Co-Doing client or a Co-Watching client.
Manage the collaboration starting state
When an add-on is first opened, it loads a state that
might be different from the starting state that the
add-on wants to use when users are joining using the
collaboration invite. The
AddonSession.Builder
uses the
withCollaborationStartingState
method to specify the
CollaborationStartingState
that should be loaded when users join the collaboration session.
You can reset or update the CollaborationStartingState
field with the
following methods:
Use the
AddonSession.resetCollaborationStartingState
method to reset the starting state of the add-on. This will clear the starting state previously received by other participants. The starting state can only be reset by the initiator.Use the
AddonSession.updateCollaborationStartingState
method to update the starting state of the add-on. Other participants receive this when they accept the invitation to collaborate. The starting state can only be updated by the initiator.
To handle the callbacks from the add-on for the
session, implement the
AddonSessionHandler
.
Callbacks allow add-on developers to react to events from the
Meet app. For the CollaborationStartingState
, use the
onCollaborationStartingStateUpdate()
method to receive the latest collaboration starting state of the
add-on session.