Class StreamCallActivity
-
- All Implemented Interfaces:
-
android.content.ComponentCallbacks,android.content.ComponentCallbacks2,android.view.KeyEvent.Callback,android.view.LayoutInflater.Factory,android.view.LayoutInflater.Factory2,android.view.View.OnCreateContextMenuListener,android.view.Window.Callback,androidx.activity.FullyDrawnReporterOwner,androidx.activity.OnBackPressedDispatcherOwner,androidx.activity.contextaware.ContextAware,androidx.activity.result.ActivityResultCaller,androidx.activity.result.ActivityResultRegistryOwner,androidx.core.app.OnMultiWindowModeChangedProvider,androidx.core.app.OnNewIntentProvider,androidx.core.app.OnPictureInPictureModeChangedProvider,androidx.core.app.OnUserLeaveHintProvider,androidx.core.content.OnConfigurationChangedProvider,androidx.core.content.OnTrimMemoryProvider,androidx.core.view.KeyEventDispatcher.Component,androidx.core.view.MenuHost,androidx.lifecycle.HasDefaultViewModelProviderFactory,androidx.lifecycle.LifecycleOwner,androidx.lifecycle.ViewModelStoreOwner,androidx.savedstate.SavedStateRegistryOwner
public abstract class StreamCallActivity extends ComponentActivity
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classStreamCallActivity.Companion
-
Field Summary
Fields Modifier and Type Field Description private final StreamActivityUiDelegate<StreamCallActivity>uiDelegateprivate final StreamCallActivityConfigurationconfigurationprivate final ActivityResultRegistryactivityResultRegistryprivate final CreationExtrasdefaultViewModelCreationExtrasprivate final ViewModelProvider.FactorydefaultViewModelProviderFactoryprivate final FullyDrawnReporterfullyDrawnReporterprivate final ObjectlastCustomNonConfigurationInstanceprivate final Lifecyclelifecycleprivate final OnBackPressedDispatcheronBackPressedDispatcherprivate final SavedStateRegistrysavedStateRegistryprivate final ViewModelStoreviewModelStorepublic final static StreamCallActivity.CompanionCompanion
-
Constructor Summary
Constructors Constructor Description StreamCallActivity()
-
Method Summary
Modifier and Type Method Description abstract StreamActivityUiDelegate<StreamCallActivity>getUiDelegate()Each activity needs its onw ui delegate that will set content to the activity. StreamCallActivityConfigurationgetConfiguration()final UnitonCreate(Bundle savedInstanceState)final UnitonCreate(Bundle savedInstanceState, PersistableBundle persistentState)UnitonCreate(Bundle savedInstanceState, PersistableBundle persistentState, Call call)Same as onCreate but with the Call as parameter. final UnitonResume()UnitonResume(Call call)Called when the activity is resumed. final UnitonUserLeaveHint()UnitonUserLeaveHint(Call call)Called when the activity is about to go into the background as the result of user choice. final UnitonPause()UnitonPause(Call call)Called when the activity is paused. final UnitonStop()UnitonStop(Call call)Called when the activity is stopped. UnitonIntentAction(Call call, String action, SuspendFunction1<Exception, Unit> onError, SuspendFunction1<Call, Unit> onSuccess)Handles action from the intent. UnitonPreCreate(Bundle savedInstanceState, PersistableBundle persistentState)Called when the activity is created, but the SDK is not yet initialized. UnitonFailed(Exception exception)Called when the activity has failed for any reason. UnitonEnded(Call call)Called when call has ended successfully, either by action from the user or backend event. UnitonBackPressed(Call call)Invoked when back button is pressed. BooleanisVideoCall(Call call)final UnitenterPictureInPicture()Enter picture in picture mode. Unitcall(StreamCallId cid, Function1<Call, Unit> onSuccess, Function1<Exception, Unit> onError)Get a call instance with the members list and call ID. Unitcreate(Call call, Boolean ring, List<String> members, SuspendFunction1<Call, Unit> onSuccess, SuspendFunction1<Exception, Unit> onError)Create (or get) the call. Unitget(Call call, SuspendFunction1<Call, Unit> onSuccess, SuspendFunction1<Exception, Unit> onError)Get a call. Unitjoin(Call call, SuspendFunction1<Call, Unit> onSuccess, SuspendFunction1<Exception, Unit> onError)Accept an incoming call. Unitaccept(Call call, SuspendFunction1<Call, Unit> onSuccess, SuspendFunction1<Exception, Unit> onError)Accept an incoming call. Unitreject(Call call, RejectReason reason, SuspendFunction1<Call, Unit> onSuccess, SuspendFunction1<Exception, Unit> onError)Reject the call in the parameter. Unitcancel(Call call, SuspendFunction1<Call, Unit> onSuccess, SuspendFunction1<Exception, Unit> onError)Cancel an outgoing call if any. Unitleave(Call call, SuspendFunction1<Call, Unit> onSuccess, SuspendFunction1<Exception, Unit> onError)Leave the call from the parameter. Unitend(Call call, SuspendFunction1<Call, Unit> onSuccess, SuspendFunction1<Exception, Unit> onError)End the call. UnitonCallAction(Call call, CallAction action)Called when there was an UI action invoked for the call. UnitonCallEvent(Call call, VideoEvent event)Call events handler. UnitonLastParticipant(Call call)Called when current device has become the last participant in the call. UnitonPictureInPicture(Call call)Get notified when the activity enters picture in picture. UnitonConnectionEvent(Call call, RealtimeConnection state)Called when there has been a new event from the socket. -
Methods inherited from class androidx.activity.ComponentActivity
addContentView, addMenuProvider, addMenuProvider, addMenuProvider, addOnConfigurationChangedListener, addOnContextAvailableListener, addOnMultiWindowModeChangedListener, addOnNewIntentListener, addOnPictureInPictureModeChangedListener, addOnTrimMemoryListener, addOnUserLeaveHintListener, getActivityResultRegistry, getDefaultViewModelCreationExtras, getDefaultViewModelProviderFactory, getFullyDrawnReporter, getLastCustomNonConfigurationInstance, getLifecycle, getOnBackPressedDispatcher, getSavedStateRegistry, getViewModelStore, initializeViewTreeOwners, invalidateMenu, onBackPressed, onConfigurationChanged, onCreatePanelMenu, onMenuItemSelected, onMultiWindowModeChanged, onMultiWindowModeChanged, onPanelClosed, onPictureInPictureModeChanged, onPictureInPictureModeChanged, onPreparePanel, onRequestPermissionsResult, onRetainCustomNonConfigurationInstance, onRetainNonConfigurationInstance, onTrimMemory, peekAvailableContext, registerForActivityResult, registerForActivityResult, removeMenuProvider, removeOnConfigurationChangedListener, removeOnContextAvailableListener, removeOnMultiWindowModeChangedListener, removeOnNewIntentListener, removeOnPictureInPictureModeChangedListener, removeOnTrimMemoryListener, removeOnUserLeaveHintListener, reportFullyDrawn, setContentView, setContentView, setContentView, startActivityForResult, startActivityForResult, startIntentSenderForResult, startIntentSenderForResult -
Methods inherited from class androidx.core.app.ComponentActivity
dispatchKeyEvent, dispatchKeyShortcutEvent, getExtraData, putExtraData, superDispatchKeyEvent -
Methods inherited from class android.view.ContextThemeWrapper
applyOverrideConfiguration, getAssets, getResources, getTheme, setTheme -
Methods inherited from class android.content.ContextWrapper
bindIsolatedService, bindService, bindService, bindService, bindService, bindServiceAsUser, bindServiceAsUser, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingOrSelfUriPermissions, checkCallingPermission, checkCallingUriPermission, checkCallingUriPermissions, checkContentUriPermissionFull, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, checkUriPermissions, clearWallpaper, createAttributionContext, createConfigurationContext, createContext, createContextForSplit, createDeviceContext, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, createWindowContext, createWindowContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAttributionSource, getAttributionTag, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDataDir, getDatabasePath, getDeviceId, getDir, getDisplay, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFileStreamPath, getFilesDir, getMainExecutor, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getOpPackageName, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getParams, getSharedPreferences, getSystemServiceName, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, isUiContext, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerDeviceIdChangeListener, registerReceiver, registerReceiver, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeSelfPermissionsOnKill, revokeUriPermission, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setWallpaper, setWallpaper, startForegroundService, startInstrumentation, startService, stopService, unbindService, unregisterDeviceIdChangeListener, unregisterReceiver, updateServiceGroup -
Methods inherited from class android.content.Context
bindIsolatedService, getColor, getColorStateList, getDrawable, getString, getString, getSystemService, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, revokeSelfPermissionOnKill, sendBroadcastWithMultiplePermissions -
Methods inherited from class android.app.Activity
clearOverrideActivityTransition, closeContextMenu, closeOptionsMenu, createPendingResult, dismissDialog, dismissKeyboardShortcutsHelper, dispatchGenericMotionEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, dump, enterPictureInPictureMode, enterPictureInPictureMode, findViewById, finish, finishActivity, finishActivityFromChild, finishAffinity, finishAfterTransition, finishAndRemoveTask, finishFromChild, getActionBar, getApplication, getCaller, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getContentScene, getContentTransitionManager, getCurrentCaller, getCurrentFocus, getFragmentManager, getInitialCaller, getIntent, getLastNonConfigurationInstance, getLaunchedFromPackage, getLaunchedFromUid, getLayoutInflater, getLoaderManager, getLocalClassName, getMaxNumPictureInPictureActions, getMediaController, getMenuInflater, getOnBackInvokedDispatcher, getParent, getParentActivityIntent, getPreferences, getReferrer, getRequestedOrientation, getSearchEvent, getSplashScreen, getSystemService, getTaskId, getTitle, getTitleColor, getVoiceInteractor, getVolumeControlStream, getWindow, getWindowManager, hasWindowFocus, invalidateOptionsMenu, isActivityTransitionRunning, isChangingConfigurations, isChild, isDestroyed, isFinishing, isImmersive, isInMultiWindowMode, isInPictureInPictureMode, isLaunchedFromBubble, isLocalVoiceInteractionSupported, isTaskRoot, isVoiceInteraction, isVoiceInteractionRoot, managedQuery, moveTaskToBack, navigateUpTo, navigateUpToFromChild, onActionModeFinished, onActionModeStarted, onActivityReenter, onActivityResult, onAttachFragment, onAttachedToWindow, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreateContextMenu, onCreateDescription, onCreateNavigateUpTaskStack, onCreateOptionsMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onCreateView, onDetachedFromWindow, onEnterAnimationComplete, onGenericMotionEvent, onGetDirectActions, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onLocalVoiceInteractionStarted, onLocalVoiceInteractionStopped, onLowMemory, onMenuOpened, onNavigateUp, onNavigateUpFromChild, onNewIntent, onOptionsItemSelected, onOptionsMenuClosed, onPerformDirectAction, onPictureInPictureRequested, onPictureInPictureUiStateChanged, onPostCreate, onPrepareNavigateUpTaskStack, onPrepareOptionsMenu, onProvideAssistContent, onProvideAssistData, onProvideKeyboardShortcuts, onProvideReferrer, onRequestPermissionsResult, onRestoreInstanceState, onSaveInstanceState, onSearchRequested, onSearchRequested, onStateNotSaved, onTopResumedActivityChanged, onTouchEvent, onTrackballEvent, onUserInteraction, onVisibleBehindCanceled, onWindowAttributesChanged, onWindowFocusChanged, onWindowStartingActionMode, onWindowStartingActionMode, openContextMenu, openOptionsMenu, overrideActivityTransition, overrideActivityTransition, overridePendingTransition, overridePendingTransition, postponeEnterTransition, recreate, registerActivityLifecycleCallbacks, registerComponentCallbacks, registerForContextMenu, registerScreenCaptureCallback, releaseInstance, removeDialog, requestDragAndDropPermissions, requestFullscreenMode, requestPermissions, requestPermissions, requestShowKeyboardShortcuts, requestVisibleBehind, requestWindowFeature, requireViewById, runOnUiThread, setActionBar, setAllowCrossUidActivitySwitchFromBelow, setContentTransitionManager, setDefaultKeyMode, setEnterSharedElementCallback, setExitSharedElementCallback, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setFinishOnTouchOutside, setImmersive, setInheritShowWhenLocked, setIntent, setIntent, setLocusContext, setMediaController, setPictureInPictureParams, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRecentsScreenshotEnabled, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setShouldDockBigOverlays, setShowWhenLocked, setTaskDescription, setTheme, setTitle, setTitle, setTitleColor, setTranslucent, setTurnScreenOn, setVisible, setVolumeControlStream, setVrModeEnabled, shouldDockBigOverlays, shouldShowRequestPermissionRationale, shouldShowRequestPermissionRationale, shouldUpRecreateTask, showAssist, showDialog, showDialog, showLockTaskEscapeMessage, startActionMode, startActionMode, startActivities, startActivities, startActivity, startActivity, startActivityFromChild, startActivityFromChild, startActivityFromFragment, startActivityFromFragment, startActivityIfNeeded, startActivityIfNeeded, startIntentSender, startIntentSender, startIntentSenderFromChild, startIntentSenderFromChild, startLocalVoiceInteraction, startLockTask, startManagingCursor, startNextMatchingActivity, startNextMatchingActivity, startPostponedEnterTransition, startSearch, stopLocalVoiceInteraction, stopLockTask, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterActivityLifecycleCallbacks, unregisterComponentCallbacks, unregisterForContextMenu, unregisterScreenCaptureCallback -
Methods inherited from class android.view.Window.Callback
onPointerCaptureChanged -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getUiDelegate
abstract StreamActivityUiDelegate<StreamCallActivity> getUiDelegate()
Each activity needs its onw ui delegate that will set content to the activity.
Any extending activity must provide its own ui delegate that manages the UI.
-
getConfiguration
StreamCallActivityConfiguration getConfiguration()
-
onCreate
final Unit onCreate(Bundle savedInstanceState, PersistableBundle persistentState)
-
onCreate
Unit onCreate(Bundle savedInstanceState, PersistableBundle persistentState, Call call)
Same as onCreate but with the Call as parameter. The onCreate method will crash with IllegalArgumentException if the call cannot be loaded or if the intent was created incorrectly, thus arriving in this method means that the call is already available.
-
onResume
Unit onResume(Call call)
Called when the activity is resumed. Makes sure the call object is available.
-
onUserLeaveHint
final Unit onUserLeaveHint()
-
onUserLeaveHint
Unit onUserLeaveHint(Call call)
Called when the activity is about to go into the background as the result of user choice. Makes sure the call object is available.
- Parameters:
call- the call
-
onPause
Unit onPause(Call call)
Called when the activity is paused. Makes sure the call object is available.
- Parameters:
call- the call
-
onStop
Unit onStop(Call call)
Called when the activity is stopped. Makes sure the call object is available. Will leave the call if onStop is called while in Picture-in-picture mode.
- Parameters:
call- the call
-
onIntentAction
Unit onIntentAction(Call call, String action, SuspendFunction1<Exception, Unit> onError, SuspendFunction1<Call, Unit> onSuccess)
Handles action from the intent.
- Parameters:
call- the callaction- the action.
-
onPreCreate
@CallSuper()@StreamCallActivityDelicateApi() Unit onPreCreate(Bundle savedInstanceState, PersistableBundle persistentState)
Called when the activity is created, but the SDK is not yet initialized. Initializes the configuration and UI delegates.
-
onFailed
Unit onFailed(Exception exception)
Called when the activity has failed for any reason. The activity will finish after this call, to prevent the
finish()provide a different StreamCallActivityConfiguration.
-
onEnded
Unit onEnded(Call call)
Called when call has ended successfully, either by action from the user or backend event. The activity will finish after this call. To prevent it, provide a different StreamCallActivityConfiguration
-
onBackPressed
Unit onBackPressed(Call call)
Invoked when back button is pressed. Will leave the call and finish the activity. Override to change this behavior
- Parameters:
call- the call.
-
isVideoCall
@StreamCallActivityDelicateApi() Boolean isVideoCall(Call call)
-
enterPictureInPicture
@StreamCallActivityDelicateApi() final Unit enterPictureInPicture()
Enter picture in picture mode. By default supported for video calls.
-
call
@StreamCallActivityDelicateApi() Unit call(StreamCallId cid, Function1<Call, Unit> onSuccess, Function1<Exception, Unit> onError)
Get a call instance with the members list and call ID.
Note: Callbacks are posted on Dispatchers.Main dispatcher.
- Parameters:
cid- the call IDonSuccess- callback where the Call object is returnedonError- callback when the Call was not returned.
-
create
@StreamCallActivityDelicateApi() Unit create(Call call, Boolean ring, List<String> members, SuspendFunction1<Call, Unit> onSuccess, SuspendFunction1<Exception, Unit> onError)
Create (or get) the call.
- Parameters:
call- the call objectring- if the call should ring for other participants (sends push)members- members of the callonSuccess- invoked when operation is sucessfullonError- invoked when operation failed.
-
get
@StreamCallActivityDelicateApi() Unit get(Call call, SuspendFunction1<Call, Unit> onSuccess, SuspendFunction1<Exception, Unit> onError)
Get a call. Used in cases like "incoming call" where you are sure that the call is already created.
- Parameters:
call- the callonSuccess- invoked when operation is sucessfullonError- invoked when operation failed.
-
join
@StreamCallActivityDelicateApi() Unit join(Call call, SuspendFunction1<Call, Unit> onSuccess, SuspendFunction1<Exception, Unit> onError)
Accept an incoming call.
- Parameters:
call- the call to accept.onSuccess- invoked when the Call.join has finished.onError- invoked when operation failed.
-
accept
@StreamCallActivityDelicateApi() Unit accept(Call call, SuspendFunction1<Call, Unit> onSuccess, SuspendFunction1<Exception, Unit> onError)
Accept an incoming call.
- Parameters:
call- the call to accept.onSuccess- invoked when the Call.join has finished.onError- invoked when operation failed.
-
reject
@StreamCallActivityDelicateApi() Unit reject(Call call, RejectReason reason, SuspendFunction1<Call, Unit> onSuccess, SuspendFunction1<Exception, Unit> onError)
Reject the call in the parameter.
Invokes Call.reject then Call.leave. Optionally callbacks are invoked.
- Parameters:
call- the call to rejectonSuccess- optionally get notified if the operation was success.onError- optionally get notified if the operation failed.
-
cancel
@StreamCallActivityDelicateApi() Unit cancel(Call call, SuspendFunction1<Call, Unit> onSuccess, SuspendFunction1<Exception, Unit> onError)
Cancel an outgoing call if any. Same as reject but can be overridden for different behavior on Outgoing calls.
- Parameters:
call- the Call to cancel.onSuccess- optionally get notified if the operation was success.onError- optionally get notified if the operation failed.
-
leave
@StreamCallActivityDelicateApi() Unit leave(Call call, SuspendFunction1<Call, Unit> onSuccess, SuspendFunction1<Exception, Unit> onError)
Leave the call from the parameter.
- Parameters:
call- the call object.onSuccess- optionally get notified if the operation was success.onError- optionally get notified if the operation failed.
-
end
@StreamCallActivityDelicateApi() Unit end(Call call, SuspendFunction1<Call, Unit> onSuccess, SuspendFunction1<Exception, Unit> onError)
End the call.
- Parameters:
call- the callonSuccess- optionally get notified if the operation was success.onError- optionally get notified if the operation failed.
-
onCallAction
@CallSuper() Unit onCallAction(Call call, CallAction action)
Called when there was an UI action invoked for the call.
- Parameters:
call- the callaction- the action.
-
onCallEvent
@CallSuper() Unit onCallEvent(Call call, VideoEvent event)
Call events handler.
- Parameters:
call- the call.event- the event.
-
onLastParticipant
@CallSuper() Unit onLastParticipant(Call call)
Called when current device has become the last participant in the call. Invokes LeaveCall action for audio calls.
- Parameters:
call- the call.
-
onPictureInPicture
@CallSuper() Unit onPictureInPicture(Call call)
Get notified when the activity enters picture in picture.
-
onConnectionEvent
@CallSuper()@StreamCallActivityDelicateApi() Unit onConnectionEvent(Call call, RealtimeConnection state)
Called when there has been a new event from the socket.
- Parameters:
call- the callstate- the state
-
-
-
-