Skip to content

Upgrade to BandyerSDK 1.3.x

Kristiyan Petrov edited this page Aug 2, 2019 · 5 revisions

Call capabilities and call options

In order to support a more flexible and extendable way to declare call settings and options it has been necessary to update the public interface of the BandyerIntent.

The main use case that currently benefits from this change is represented by the declaration of call types that can be started from chat UI. It is now possible to declare audio calls as well as audio upgradable calls even in a separate way.

Call features are now reported as call capabiities representing side feature that can be optionally available during calls, enriching the communicative experience.

Call capabilities are now grouped under the CallCapabilities object and are now represented by:

  • Whiteboard (requires API 19)
  • File sharing
  • Chat (requires API 19)
  • Screen Sharing (requires API 21)

Other call settings are now grouped under the CallOptions object and are now represented by:

  • Call recording
  • Back camera as default (if available)
  • Disable proximity sensor (it can be useful with custom devices such as smartglasses)

The following code represents the updated way to initialize a call:

CallCapabilities capabilities = new CallCapabilities()
			.withWhiteboard()
			.withFileSharing()
			.withChat()
			.withScreenSharing();

CallOptions options = new CallOptions()
			.withRecordingEnabled()
			.withBackCameraAsDefault()
			.withProximitySensorDisabled();

BandyerIntent bandyerCallIntent = new BandyerIntent.Builder().startWithAudioVideoCall(this)
	.with(calleesArrayList)
	.withCapabilities(capabilities) // optional
	.withOptions(options) // optional
	.build();
                
startActivity(bandyerCallIntent);

The following code represents the updated way to initialize a chat:

CallCapabilities capabilities = new CallCapabilities()
			.withWhiteboard()
			.withFileSharing()
			.withChat()
			.withScreenSharing();

CallOptions options = new CallOptions()
			.withRecordingEnabled()
			.withBackCameraAsDefault()
			.withProximitySensorDisabled();

BandyerIntent bandyerChatIntent = new BandyerIntent.Builder().startWithChat(this)
	.with(userAlias)
	.withAudioCallCapability(capabilities, options)  // optional
	.withAudioUpgradableCallCapability(capabilities, options)  // optional
	.withAudioVideoCallCapability(capabilities, options)  // optional
	.build();
                
startActivity(bandyerChatIntent);

Observing ongoing call or chat

CallStatusEventObserver class is now deprecated and it will be removed in upcoming releases.

BandyerIntent cannot be passed to the activity's function startActivityForResult anymore because call and chat UIs are now launched as separated task and otherwise a result would it be instantly returned in onActivityResult method, preventing the returning of any error generating in the chat or call UI.

The new way to observe an ongoing call or chat, and any errors coming from the UIs and undergoing processes, should be implemented as follows:

CallModule callModule = BandyerSDKClient.getInstance().getCallModule();
if (callModule == null) return;
callModule.addCallObserver(this, new CallObserver() {
            @Override
            public void onCallStarted() {
                Log.d(TAG, "onCallStarted");
            }

            @Override
            public void onCallEnded() {
                Log.d(TAG, "onCallEnded");
            }

            @Override
            public void onCallEndedWithError(@NonNull CallException callException) {
                Log.e(TAG, "onCallEnded with error: " + callException.getMessage());
            }
        });
        

ChatModule chatModule = BandyerSDKClient.getInstance().getChatModule();
if (chatModule == null) return;
chatModule.addChatObserver(this, new ChatObserver() {
            @Override
            public void onChatStarted() {
                Log.d(TAG, "onChatStarted");
            }

            @Override
            public void onChatEnded() {
                Log.d(TAG, "onChatEnded");
            }

            @Override
            public void onChatEndedWithError(@NonNull ChatException chatException) {
                Log.e(TAG, "onChatEndedWithError: " + chatException.getMessage());
            }
        });

AndroidX support

BandyerSDK is now fully compatible and based upon AndroidX and requires that integrating apps should be based on AndroidX as well. The last supported SDK version without AndroidX is v1.2.1 so if your project cannot be updated please refer to this version. Please keep in mind that any support for pre-AndroidX compatibility is now on interrupted. Migration process to AndroidX is quite simple with the Android Studio migration support. If your app needs to be updated to AndroidX please refer to: https://developer.android.com/jetpack/androidx/migrate.

Clone this wiki locally