Share a screen using Daily's Android SDK
Screen sharing enables the local participant to display the contents of their screen to other users in the meeting.
Before you begin, ensure that you understand how to start a video call. For details, see our Introduction to the Daily Client SDKs for Android and iOS.
This guide will describe how to implement screen sharing using the Android SDK, showing you some examples, and pointing you to where you can learn more.
How to start a screen share
The first task for the app is to request the MediaProjection
permission activity.
It must validate that the result code is Activity.RESULT_OK
before calling the Daily SDK to initiate the screen sharing.
Once the permission is granted, the daily-android
SDK can be invoked to start screen sharing.
The following code snippet shows how you might start a screen share:
To confirm that screen sharing started, listen for onInputsUpdated event and check the property screenVideo
.
To use screen sharing, a Foreground Service is required. This is needed because the app performs tasks that continue even when the app is not in the foreground. You can find more details about how to start a Foreground Service in our installation guide.
How to stop screen share
The following code snippet shows how you might stop a screen share:
How to check if the local screen sharing is enabled
The following code snippet shows how you might check if the local screen sharing is enabled:
Demo app
To see a working example of how to interact with the Daily Client SDK for screen sharing, see our Android demo app.