public interface

ScreenSharingRequest

com.glia.androidsdk.screensharing.ScreenSharingRequest

Class Overview

Allows to accept or decline screen sharing requests made by an Operator.
Example - notifying Visitor about screen sharing request:

 engagement.getScreenSharing().on(ScreenSharing.Events.SCREEN_SHARING_REQUEST, screenSharingRequest -> {
     runOnUiThread(() -> {
         Runnable onAccept = () -> {
             screenSharingRequest.accept(ScreenSharing.Mode.APP_BOUNDED, MainActivity.this, gliaRequestCode, error -> {
                 if (error != null) {
                     // handle error
                 }
             });
         };

         Runnable onDecline = screenSharingRequest::decline;
         showScreenSharingRequest(onAccept, onDecline);
     });
 });
 

To allow Glia SDK to receive activity results add onActivityResult(int, int, Intent) to your current activity:
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
     engagement.onActivityResult(requestCode, resultCode, data);
 }
 

Summary

Public Methods
abstract void accept(ScreenSharing.Mode mode, Fragment fragment, int requestCode, Consumer<GliaException> onResult)
Accepts screen sharing request.
abstract void accept(ScreenSharing.Mode mode, Activity activity, int requestCode, Consumer<GliaException> onResult)
Accepts screen sharing request.
abstract void accept(ScreenSharing.Mode mode, androidx.fragment.app.Fragment fragment, int requestCode, Consumer<GliaException> onResult)
Accepts screen sharing request.
abstract void decline()
Decline screen sharing request.

Public Methods

public abstract void accept (ScreenSharing.Mode mode, Fragment fragment, int requestCode, Consumer<GliaException> onResult)

Accepts screen sharing request.

Similar to accept(Mode, Activity, int, Consumer) but accepts Fragment instance instead of Activity.

Parameters
mode Screen sharing mode. One of ScreenSharing.Mode.
fragment Current fragment. Must be attached to activity, otherwise communication might not start.
requestCode Unique request code
onResult Called with null on success or with GliaException if the process fails for any reason. The GliaException may have one of the following causes:
PERMISSIONS_DENIED - when Visitor has not given screen capture permissions
INTERNAL_ERROR - when internal error occurs
INVALID_INPUT - when one of parameters is null.

public abstract void accept (ScreenSharing.Mode mode, Activity activity, int requestCode, Consumer<GliaException> onResult)

Accepts screen sharing request.

When called the Visitor is prompted to give screen sharing permissions. Screen sharing is started immediately after the permissions are given.

This method requires a current Activity and a unique request code that can be used to trigger a screen capture permission prompt via Activity#startActivityForResult(Intent, int). The request code is unique integer, that it is not used for your own activity results.

Make sure to call onActivityResult(int, int, Intent) from the provided activity's Activity#onActivityResult(int, int, Intent) to allow Glia SDK to consume screen capture permission prompt result.

Apps targeting Android SDK version Build.VERSION_CODES.Q or later should have foreground service. The service should be registered in Manifest and specify ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION as part of foregroundServiceType

Parameters
mode Screen sharing mode. One of ScreenSharing.Mode.
activity Current activity
requestCode Unique request code
onResult Called with null on success or with GliaException if the process fails for any reason. The GliaException may have one of the following causes:
PERMISSIONS_DENIED - when Visitor has not given screen capture permissions
INTERNAL_ERROR - when internal error occurs
INVALID_INPUT - when one of parameters is null.

public abstract void accept (ScreenSharing.Mode mode, androidx.fragment.app.Fragment fragment, int requestCode, Consumer<GliaException> onResult)

Accepts screen sharing request.

Similar to accept(Mode, Activity, int, Consumer) but accepts androidx.fragment.app.Fragment instance instead of Activity.

Parameters
mode Screen sharing mode. One of ScreenSharing.Mode.
fragment Current fragment. Must be attached to activity, otherwise communication might not start.
requestCode Unique request code
onResult Called with null on success or with GliaException if the process fails for any reason. The GliaException may have one of the following causes:
PERMISSIONS_DENIED - when Visitor has not given screen capture permissions
INTERNAL_ERROR - when internal error occurs
INVALID_INPUT - when one of parameters is null.

public abstract void decline ()

Decline screen sharing request.