Greater feature velocity and in parity with the Webex mobile app.
Easier for developers community: SQLite is bundled for automatic data caching.
Greater quality as it is built on a more robust infrastructure.
Notes
Integrations created earlier will not work with v3 because they are not entitled to the scopes required by v3. You can either raise a support request to enable these scopes for your appId or you could create a new Integration that's meant to be used for v3. This does not affect Guest Issuer JWT token-based sign-in.
FedRAMP(
Federal Risk and Authorization Management Program) support from 3.1 onwards.
Currently all resource ids that are exposed from the SDK are barebones GUIDs. You cannot directly use these ids to make calls to webexapis.com. You'll need to call Webex.base64Encode(type: ResourceType, resource: String, handler: CompletionHandler<String>) to get a base64 encoded resource. However, you're free to interchange between base64 encoded resource ids and barebones GUID while providing them as input to the SDK APIs.
You can add android:extractNativeLibs="true" inside your <application> tag in your Manifest file to reduce the generated apk size.
You can split the application APKs based on architecture for individual distribution. To get details of each architecture library and sample application sizes please visit here
The Webex.initialize method should be called before invoking any other api.
Integration
Option 1
Put AAR file in libs folder of your Android project
Open the project level Gradle file and add the following lines under the repositories tag, which is nested under allprojects.
allprojects {
repositories {
flatDir { dirs 'aars'} //add this line
}
}
Add the following dependency in module level Gradle file and press sync-now
implementation files('libs/WebexSDK.aar')
Option 2
Add the following repository to your top-level build.gradle file:
To use the SDK, you will need Cisco Webex integration credentials. If you do not already have a Cisco Webex account, visit the Cisco Webex for Developers portal to create your account and register an integration. Your app will need to authenticate users via an OAuth grant flow for existing Cisco Webex users or a JSON Web Token for guest users without a Cisco Webex account.
See the Android SDK area of the Cisco Webex for Developers site for more information about this SDK.
Examples
Here are some examples of how to use the Android SDK in your app.
Create a new Webex instance using Webex ID authentication (OAuth-based):
val clientId:String="YOUR_CLIENT_ID"val clientSecret:String="YOUR_CLIENT_SECRET"val redirectUri:String="https://webexdemoapp.com"val scope:String="spark:all"val email ="EMAIL_ID_OF_END_USER"// Get email id from end userval authenticator:OAuthWebViewAuthenticator=OAuthWebViewAuthenticator(clientId, clientSecret, scope, redirectUri, email)
val webex =Webex(application, authenticator)
webex.enableConsoleLogger(true)
webex.setLogLevel(LogLevel.VERBOSE) // Highly recommended to make this end-user configurable incase you need to get detailed logs.
webex.initialize(CompletionHandler { result ->if (result.error ==null) {
//already authorised
} else {
authenticator.authorize(loginWebview, CompletionHandler { result ->if (result.error !=null) {
//Handle the error
}else{
//Authorization successful
}
})
}
})
Create a new Webex instance using JWT authentication
val token:String="jwt_token"val authenticator:JWTAuthenticator=JWTAuthenticator()
val webex =Webex(application, authenticator)
webex.initialize(CompletionHandler { result ->if (result.error ==null) {
//already authorised
} else {
authenticator.authorize(token, CompletionHandler { result ->if (result.error !=null) {
//Handle the error
}else{
//Authorization successful
}
})
}
})
Create a new Webex instance using access token authentication
val token:String="<your-access-token>"val expiryInSeconds =60//expiry time in secondsval authenticator:TokenAuthenticator=TokenAuthenticator()
val webex =Webex(application, authenticator)
webex.initialize(CompletionHandler { result ->if (result.error ==null) {
//already authorised
} else {
authenticator.authorize(token, expiryInSeconds, CompletionHandler { result ->if (result.error !=null) {
//Handle the error
}else{
//Authorization successful
}
})
}
})
Create a new Cisco Webex space, add users to the space, and send a message:
// Create a Cisco Webex space:
webex.spaces.create("Hello World", null, CompletionHandler<Space?> { result ->if (result.isSuccessful) {
val space = result.data
} else {
val error= result.error
}
})
// Add a user to a space:
webex.memberships.create("spaceId", null, "[email protected]", true, CompletionHandler<Membership?> { result ->if (result.isSuccessful) {
val space = result.data
} else {
val error= result.error
}
})
// Send a message to a space:
webex.messages.postToSpace("spaceId", Message.Text.plain("Hello"), null, null, CompletionHandler<Message> { result ->if(result !=null&& result.isSuccessful){
val message = result.data
}
})
//Mark all existing messages in space as read
webex.messages.markAsRead(spaceId)
//Mark existing message before pointed message(include) in space as read
webex.message.markAsRead(spaceId, messageId)
//Mark existing message before pointed message(include) in space as read with a completion handler
webex.message.markAsRead(spaceId, messageId, CompletionHandler { result ->if (result.isSuccessful) {
// Success
} else {
// Failure
}
})
Get read status of a space
webex.spaces.getWithReadStatus(spaceId, CompletionHandler { result ->if (result.isSuccessful) {
//show the data
} else {
//handle error
}
})
Set MembershipObserver to receive Membership events
webex.memberships.setMembershipObserver(object:MembershipObserver {
overridefunonEvent(event:MembershipObserver.MembershipEvent?) {
when (event) {
isMembershipObserver.MembershipCreated-> {
//The event when a new membership has added to a space....
}
isMembershipObserver.MembershipUpdated-> {
//The event when a membership moderator status changed...
}
isMembershipObserver.MembershipDeleted-> {
//The event when a membership has been removed from a space....
}
isMembershipObserver.MembershipMessageSeen-> {
//The event when a user has sent a read receipt...
}
}
}
})
Set SpaceObserver to receive Space events
webex.spaces.setSpaceObserver(object:SpaceObserver {
overridefunonEvent(event:SpaceObserver.SpaceEvent) {
when (event) {
isSpaceObserver.SpaceCallStarted-> {
//The event when a space call was started...
}
isSpaceObserver.SpaceCallEnded-> {
//The event when a space call has ended...
}
isSpaceObserver.SpaceCreated-> {
//The event when a new space was created...
}
isSpaceObserver.SpaceUpdated-> {
//The event when a space was changed (usually a rename)...
}
}
}
})
Get space meeting details
webex.spaces().getMeeting(spaceId, new CompletionHandler<SpaceMeeting>() {
@Override
public void onComplete(Result<SpaceMeeting> result) {
if (result.isSuccessful()){
SpaceMeeting spaceMeeting = result.getData();
...
}
}
});
Get read status of a space
webex.spaces().getWithReadStatus(spaceId, new CompletionHandler<SpaceReadStatus>() {
@Override
public void onComplete(Result<SpaceReadStatus> result) {
if (result.isSuccessful()){
SpaceReadStatus spaceReadStatus = result.getData();
...
}
}
});
webex.spaces.listWithActiveCalls(CompletionHandler { result ->if (result.isSuccessful) {
// callback returned success, result.data gives data if any
} else {
// callback returned failure
}
})