Symptom
Opentok Android SDK version 2.28.2 can generate the error below if you use an application context to initialize a publisher.
java.lang.UnsupportedOperationException: Tried to obtain display from a Context
not associated with one. Only visual Contexts (such as Activity or one created
with Context#createWindowContext) or ones created with Context#createDisplayContext
are associated with displays. Other types of Contexts are typically related to
background entities and may
return
an arbitrary display
In previous SDK versions, it was possible to build a new publisher using the application context.
Applies To
- Video API
- Android SDK
Resolution
In 2.28.2 it is necessary to pass the activity context and not the application context to the publisher builder.
Cause
This issue occurs because a function in the Android SDK was deprecated. Changes were made to remove dependency on the deprecated functions. We are currently testing alternative options that would again allow usage of the application context and hope to get these included in the next release.
Additional Information
For more details, please visit to android SDK release notes: https://tokbox.com/developer/sdks/android/release-notes.html
Related to:
Articles in this section
- Migrating Video REST API from OpenTok to Unified
- Video Client SDK Changes from OpenTok to Unified
- How to Migrate from OpenTok Server SDK to Unified Server SDK
- Credential Differences Between OpenTok and Unified Environments
- In which Regional Media Zones can I use Experience Composer?
- How do I monitor Video API call quality in real-time?
- JWT Tokens in the TokBox and Unified Environments
- Android SDK 2.28.2 error when using the application context
- What happens if your session lasts more than 8 hours?
- Updates to using the Vonage Media Library in Native SDKs from version 2.27.x onwards