What’s new in the DocuSign Android SDK

The DocuSign Android SDK is engineered for signing reliability and seamless integration. Developers are now able to integrate with the most robust signing solution within mobile apps regardless of internet connectivity. You may already know that the DocuSign Android SDK offers the ability to sign when in poor connectivity situations. But now the SDK also supports the myriad of signing features available with embedded signing (online signing). Additionally, with v1.1.5, we've included changes to better tailor the integration of SDK components within your app. Let's walk through some of these new additions. 

Online Signing

As of v1.1.0, the DocuSign Android SDK provides an API for coordinating signing with an embedded web view, otherwise known as Online Signing. With Online Signing, developers can use a familiar but enhanced signing view similar to the ones found through browsers, but customized for mobile usage. 

Online signing is compatible with templates and envelopes created from the SDK API. Using online signing through the SDK enables developers to reduce complexity and potential points of failure that can be introduced with multiple moving parts between the REST API and browsers.  

For example, let's consider a hypothetical financial services scenario: TGK Capital would like to provide their investors a seamless signing experience when they are signing investor agreement contracts. TGK Portfolio Manager uses the TGK Capital app, which is integrated with the DocuSign Android SDK for signing agreements with their investors. 

This video shows a preview of the TGK Capital sample app, which uses the DocuSign Android SDK Online Signing feature:

Let’s take a look at how this works with Templates.

Online Signing using templates

Let’s say you have a repeatable workflow and need to use a form over and over again. Now, you can repeat your workflow using a template by invoking the following SDK API. To use the existing template, simply call the following methods:

val templateDelegate = DocuSign.getInstance().getTemplateDelegate()
templateDelegate.useTemplateOnline(context, 
                                   templateId,
                                   envelopeDefaults,
                                   object : DSOnlineUseTemplateListener {
            override fun onStart(envelopeId: String) { }

            override fun onCancel(envelopeId: String, 
                                  recipientId: String) { }

            override fun onComplete(envelopeId: String,
                                    onlySent: Boolean) { }

            override fun onError(envelopeId: String?,
                                 exception: DSTemplateException) { }

            override fun onRecipientSigningError(envelopeId: String,  
                                 recipientId: String,
                                 exception: DSTemplateException) { }

            override fun onRecipientSigningSuccess(envelopeId: String, 
                                              recipientId: String) { }
        })

You can also provide EnvelopeDefaults in the above API call to prefill the template with recipient details, set tags values, set custom fields and envelope details. 

Online Signing using an envelope created from the SDK 

Invoke the following SDK API to perform Online Signing using an envelope which is created from scratch from your own PDF. You’ll create an an envelope and then launch the signing views as follows:

val envelopeDelegate = DocuSign.getInstance().getEnvelopeDelegate()
// Create envelope 
envelopeDelegate.composeAndSendEnvelope(envelope, 
		object : DSComposeAndSendEnvelopeListener {
		
		override fun onSuccess(envelopeId: String,
				       isEnvelopeSent: Boolean) {

              val signingDelegate=   
               DocuSign.getInstance().getSigningDelegate()

			// Launch Online Signing using envelope that is created from scratch 
                	signingDelegate.createEnvelopeAndLaunchOnlineSigning(
				context,
				envelopeId,
				object : DSOnlineSigningListener {

            		  override fun onStart(envelopeId: String) { }
                
            		  override fun onSuccess(envelopeId: String) { }
                
            		  override fun onCancel(envelopeId:String,
                                        recipientId: String) { }
                
            		  override fun onError(envelopeId: String?,  
                                      exception: DSSigningException) { }
                
            		  override fun onRecipientSigningError(
                                       envelopeId: String, 
                                       recipientId: String,  
                                       exception: DSSigningException) { }
                
            		 override fun onRecipientSigningSuccess( 
                                       envelopeId: String,
                                       recipientId: String) { }
                
        		})
            	}

            	override fun onError(exception: DSEnvelopeException) { }
})

Online Signing using an envelopeId from DocuSign

Have an existing envelope that you’ve created or received? All you need is the envelopeID from your existing envelope. You’ll want to invoke the following SDK API to perform Online Signing:

val signingDelegate = DocuSign.getInstance().getSigningDelegate()
// Launch Online Signing using envelopeId retrieved from DocuSign server/portal
signingDelegate.signOnline(
     context,
     serverEnvelopeId,
     object : DSOnlineSigningListener {

       override fun onStart(envelopeId: String) { }
                
       override fun onSuccess(envelopeId: String) { }
                
       override fun onCancel(envelopeId: String, 
                            recipientId: String) { }
                
       override fun onError(envelopeId: String?,
                           exception: DSSigningException) { }
                
       override fun onRecipientSigningError(envelopeId: String, 
			recipientId: String,
			exception: DSSigningException) { }
                
       override fun onRecipientSigningSuccess(envelopeId: String,
		        recipientId: String) { }
                
    })

Branding and UI configurations

For a seamless experience, the DocuSign Android SDK now provides APIs to customize the UI of the signing experience to match your app's branding/styling/theme. 

What kind of customizations are available to match your app's user experience? Here's the list you can set:

  • ActionBar Color
  • StatusBar Color
  • ActionBar Logo
  • ActionBar Title Text Color
  • BottomToolBar Button Color
  • BottomToolBar Button Text Color
  • BottomToolBar DocuSign Image Visibility
val appearanceDelegate = DocuSign.getInstance().getAppearanceDelegate()
val appearance = DSAppearance.Builder()
            .setActionBarColor(actionBarColor: ColorDrawable)
            .setStatusBarColor(statusBarColor: ColorDrawable)
            .setActionBarLogo(actionBarLogo: Drawable)
            .setActionBarTitleTextColor(actionBarTitleTextColor: ColorDrawable)
            .setBottomToolbarButtonColor(bottomToolbarColor: ColorDrawable)
            .setBottomToolbarButtonTextColor(bottomToolbarButtonColor: ColorDrawable)
            .setBottomToolbarDocuSignImageVisibility(bottomToolbarDocuSignImageVisibility: Boolean)
            .build()
appearanceDelegate.appearance = appearance

Sample apps

We’ve also built some useful sample applications to help you get started. The Kotlin sample application for the Android SDK showcases the usage of DocuSign Android SDK API and helps ease the integration process by providing you a reference implementation.

The sample app will cover the the following actions that you may require while integrating in your own app: 

Login 

In the app, you can log in to DocuSign using the SDK's login API by providing details such as IntegratorKey, ClientSecret and RedirectURI.

Template flow

The app showcases DocuSign signing based on DocuSign templates with some predefined sample templates.

Online Signing

The app shows the usage of the DocuSign Android SDK API for Online Signing with Templates. The sample performs Online Signing using template when there is network connection. You can also provide EnvelopeDefaults in this API if you want to prefill the template with recipient details, template tabs, custom fields, and more.

The app also demonstrates the usage of DocuSign Android SDK API for Online Signing by creating the envelope from just a PDF. The app will create the envelope using SDK API by providing the documents, recipient details, envelope details and custom fields. It then performs Online Signing from the created envelope when there is network connection. 

Offline Signing

For performing Offline Signing using templates, we need to cache the template first. The app uses SDK API to retrieve templates, cache template, remove template and Offline Signing with templates. The sample app performs Offline Signing using a template when there is no network connection. You can also provide EnvelopeDefaults in this API if you want to prefill the template with recipient details, template tabs, custom fields, and more. Once the document is signed offline in the sample app, you can sync the document when there is a network connection.

The app also shows the usage of the DocuSign Android SDK API for Offline Signing by creating the envelope from scratch using a PDF. It creates the envelope using SDK API by providing the documents, recipient details, envelope details, and custom fields. The app will then perform Offline Signing when there is no network connection.

Envelope flow

The app showcases document signing based from the envelope created from scratch with a PDF via the SDK.  

API additions

More features are categorized below:

Custom Settings

Some coordination screens used for hosted signing may not be necessary within your experience. The following SDK API will hide the template recipients screen displayed during the signing ceremony using templates. This API is effective only if EnvelopeDefaults are provided in signing APIs.

val customSettings = DSCustomSettings.Builder()
                    .setDisplayTemplateRecipientsScreen(false)
                    .build()
 DocuSign.getInstance().getCustomSettingsDelegate().customSettings = customSettings

Retrieving an envelope

The following SDK API retrieves the actual envelope from DocuSign.

DocuSign.getInstance().getEnvelopeDelegate().getEnvelope(serverEnvelopeId, object : DSGetEnvelopeListener {
            override fun onSuccess(envelope: DSEnvelope) { }

            override fun onError(exception: DSEnvelopeException) { }
       })

Download signing completed document

The following SDK API retrieves the document that was signed successfully.

val envelopeDelegate = DocuSign.getInstance().getEnvelopeDelegate()
envelopeDelegate.downloadCompletedEnvelopeDocument(envelopeId, object: DSDownloadCompletedEnvelopeListener {
        override fun onSuccess(envelopeId: String, fileUri: String) { }

        override fun onError(exception: DSEnvelopeException) { }
})

Clear Delegates

The following SDK API clears all SDK delegates and releases the memory.

DocuSign.getInstance().clearDelegates()

Additional resources

Naveen Tulseela, Senior Android Engineer
Author
Naveen Tulseela
Senior Android Engineer
Published
Related Topics