DEVNET-2011Jabber Guest - Android SDK Live Coding Tutorial

29
Jabber Guest – Android SDK Live Coding Tutorial Robert Tyler, Software Engineer

Transcript of DEVNET-2011Jabber Guest - Android SDK Live Coding Tutorial

Jabber Guest – Android SDK Live Coding Tutorial

Robert Tyler, Software Engineer

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

•  What we will / won’t cover

•  Requirements

•  Overview of the Jabber Guest for Android SDK

•  South Beach Bank App Demo

•  Four different app development options

•  Summary and Resources

Agenda

2

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

What we will / won’t cover •  We will cover

•  Jabber Guest for Android hierarchy / high-level overview •  Some (not all) sample code from today’s app

•  All sample code is provided for future download

•  We will not cover •  Various platforms / how to install (or configure) software

•  Intro-level Android development •  Lots of resources available for getting started with Android

•  Every Jabber Guest for Android SDK component •  Jabber Guest for Android SDK comes with documentation and sample programs

3

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

Requirements (High Level) •  Java SE Development Kit (JDK)

•  Android IDE •  Android Studio (https://developer.android.com/sdk/index.html)

•  Jabber Guest for Android SDK •  10.5 version released •  10.6 version coming soon!

•  An existing Android app •  Or, you build one now and add Jabber Guest into it

4

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

Overview of the Jabber Guest for Android SDK

5

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

Jabber Guest for Android SDK – Hierarchy

6

JabberGuestCallActivity

JabberGuestCall CallService AudioRouteManager

RenderCallbacks Log

PreviewFragment

CallFragment

PreviewView RemoteView SelfView CallBarView

KeypadView

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

What is JabberGuestCall? •  The messenger between your app, and the Cisco Jabber Guest server

•  Also handles the media between your app, and the remote endpoint •  Receives registered TextureView(s) from your app to display media content (frames)

•  Communicates info with your app via LocalBroadcastManager and registered BroadcastReceiver(s) •  New instance availability •  Call state changes •  Call control events •  Call error events

•  One instance per call lifecycle

7

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

South Beach Bank App Demo

8

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

Option 1 – JabberGuestCallActivity

9

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

Option 1 - JabberGuestCallActivity •  Simplest solution, uses pre-packaged activity

•  Manifest entry for JabberGuestCallActivity •  Import JabberGuestCallActivity in calling class •  Create intent to launch JabberGuestCallActivity (with proper intent extras)

•  No other SDK components that you are required to interact with •  JabberGuestCallActivity handles this for you •  Requires that you accept how the SDK responds to specific events during the call

lifecycle (ex. state changes, dialogs, etc.)

•  Less control over look and feel of elements in the call activity

10

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

Option 2 – SDK fragments

11

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

Option 2 – SDK fragments •  Use of Fragment Transactions to display PreviewFragment, CallFragment

•  JabberGuestCallActivity does this automatically

•  Have to decide when to show each fragment •  Call state changes from JabberGuestCall instance •  Or maybe you skip straight to CallFragment?

•  Still didn’t really have to know too much of the specifics of handling call •  Most functionality still exists with SDK fragments

•  Greater layout flexibility with fragments •  Alternative layouts with multiple fragments

•  Less control of what is shown in the fragments themselves

12

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

Option 3 – SDK views

13

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

Option 3 – SDK views •  Lots more code to write with this approach

•  Custom activity for managing SDK views (and my own views) •  Registration of a BroadcastReceiver with JabberGuestCall •  Processing of all four notification types (new instance, state change, call control, error) •  Invalid certificate handler •  MPEG-LA licensing

•  Much more control of layout since we’re directly referring to views •  We have our own layout(s) to manage however

•  Mixed approach, some views are from SDK, others are not

14

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

JabberGuestCall new instance available •  Communicate to other interested components (views, fragments, activities)

whenever a new instance has been created and is ready for use

•  Lots of SDK components use this notification

•  When registering a BroadcastReceiver, if an instance already exists you will receive this notification immediately

15

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

JabberGuestCall state change events •  Intent includes ARG_CALL_STATE_VALUE intent extra

(JabberGuestCall.State) •  GuestCallStateNotInitialized •  GuestCallStateDisconnected •  GuestCallStateConnecting •  GuestCallStateConnected •  GuestCallStateDisconnecting

16

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

JabberGuestCall call error events •  Intent will contain two key pieces of information as intent extras

•  ARG_USER_TITLE_LABEL – Title of a dialog for this error •  ARG_USER_MESSAGE_LABEL – Body of a dialog for this error

•  Other contained pieces of info (for debugging / diagnostic purposes) •  ARG_CATEGORY_LABEL – numeric code categorizing the class of error •  ARG_CODE_LABEL – numeric code categorizing any SIP-related error if applicable •  ARG_INTERNAL_MESSAGE_LABEL – string returned by SDK for error

17

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

JabberGuestCall call control events •  Intent includes ARG_CALL_CONTROL_EVENT_VALUE intent extra

(JabberGuestCall.CallControlEvent) •  audioMuted, audioUnmuted •  videoMuted, videoUnmuted •  dtmfSent •  streamsUpdated •  audioRouteUpdated •  cameraSwitched

18

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

JabberGuestCall invalid certificate handlers •  Previously handled by SDK fragments (returned a custom dialog)

•  Not handled by individual SDK views

•  Implement an interface w/ single callback (onInvalidCertificate)

•  Call one of two functions w/ JabberGuestCall instance based on conditions •  acceptInvalidCertificate •  rejectInvalidCertificate •  Choice is remembered as long as the app remains installed (for that certificate)

•  Only last registered invalid certificate handler is used by JabberGuestCall •  Careful when using SDK fragments or SDK JabberGuestCallActivity, competing

registrations

19

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

MPEG-LA licensing •  Jabber Guest for Android uses H.264 AVC video, requires license agreement

•  Any components that use this functionality will not start until this is accepted •  SelfView, PreviewView •  And containing SDK components (fragments, activities)

•  Must provide an activity context to JabberGuestCall instance prior to calling start() or setSelfTextureView() •  SDK will provide a dialog where this can be accepted •  Alternatively, you can implicitly accept the license via code,

JabberGuestCall.disableVideoLicenseActivation •  ONLY DO THIS IF YOU HAVE YOUR OWN LICENSE AGREEMENT WITH MPEG LA IN PLACE

•  Once activation completed (or disabled), will never see this popup again

20

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

Logging in SDK •  By default, SDK logs only at level android.util.Log.WARN

•  Can be manually changed to any android.util.Log.* logging level

•  Three different sub-components •  setLogLevel – for high-level SDK logging •  setJcfLogLevel – for logging from the native-level libraries used by the SDK •  setCpveLogLevel – for logging from the video engine used by the SDK

•  Logs to logcat •  Careful with the level…

21

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

Option 4 – No SDK views, fragments, or

activities

22

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

Option 4 – No SDK views, fragments, or activities •  Extra calls to JabberGuestCall to register our TextureViews

•  setSelfTextureView, setRemoteTextureView •  Optional RenderCallbacks argument, if you wanted to use your own custom views

23

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

Summary and Resources

24

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

Summary •  Four ways to use Jabber Guest for Android SDK

•  JabberGuestCallActivity •  Custom activity with SDK fragments •  Custom activity with SDK views •  Custom activity, no SDK views, fragments, or activities

•  Approach varies based on amount of flexibility and customization

25

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

Resources •  Code from this presentation

•  Included as a sample app with Jabber Guest for Android SDK (as of version 10.6)

•  DevNet •  Developer Guide -

https://developer.cisco.com/site/jabber-guestsdk/documents/android-developer-guide/ •  API / Javadoc -

https://developer.cisco.com/site/jabber-guestsdk/documents/android-api/ •  Release notes -

https://developer.cisco.com/site/jabber-guestsdk/documents/release-notes/android/

26

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID

Resources •  Early Adopter Program

•  Here at Customer Connection Program Kiosk, Collaboration area •  Free swag…

•  Registering later •  Go to Cisco Customer Connection Program (CCP) public page: www.cisco.com/go/ccp •  If you are already a CCP member, login with your cisco.com (CCO) id •  If you are not currently a CCP member, follow the instructions to join the CCP •  Once you’ve logged in, click on the link “Go to the private member community” •  Once you are in the Private – CCP space, click on the “Access & sign up for trials” button

•  Early Adopters and Beta Trials section of space •  Select the Jabber trial of interest, read the requirements, and register for the trial

27

Thank you

© 2015 Cisco and/or its affiliates. All rights reserved. Cisco Public Presentation ID 28