Introduction
This document provides instructions for integrating Ephesoft Mobile software developer kits (SDK) into your Android 5.0 and iOS 10 or greater applications. These instructions are applicable for use with Ephesoft Transact 2019.1 or above.
Prerequisites
Contact tickets@ephesoft.com for access to the SDK for your mobile platform.
The following prerequisites are required to use the Ephesoft Mobile SDKs on Android 5.0 and iOS 10 or greater platforms.
System Requirements
Android Platform
Android Studio is required to integrate Ephesoft Mobile with Android applications.
iOS Platform
The following software programs are required to use the iOS SDK:
- Xcode 10 or greater
- Swift 4.2 or greater
All the image and scanner tools in the SDK are GPU-accelerated and run close to real-time. You will need a real device to see the performance of the SDK. Simulators will not work properly and are not able to indicate SDK performance.
Implementation for Android
Perform the following steps to use the Ephesoft Mobile SDK in Android applications.
- Open Android Studio.
- Click File > New > New Module.
Figure 1. Add Ephesoft Mobile as a New Module
- Add the Android SDK as a module.
- Select Import .JAR/.AAR Package > Next.
Figure 2. New Module Dialog Box
- Enter the .AAR file path in the File name field.
- Enter the name of the module in the Subproject name field.
- Click Finish.
Figure 3. Import Module from Library Dialog Box
- Click File > Project Structure > Dependencies.
- Select the application that will be integrated with the Ephesoft Mobile module.
- Click the plus (+) icon.
Figure 4. Adding Module Dependency Example
- Select Module Dependency.
Figure 5. Declared Dependencies Dialog Box
- Select the MobileRefresh module.
- Click OK.
Figure 6. Add MobileRefresh in Dependencies
- Add the following libraries:
- Custom Open CV Library (OpenCvSdk.aar)
- Image Cropping Library (Catalano.Android.Image.aar)
- Add the following dependencies to the build.gradle file:
dependencies { implementation project(path: ':snaplib-release') implementation project(path: ':OpenCvSdk4-debug') implementation project(path: ':ImageCropping') implementation 'info.androidhive:imagefilters:1.0.7' api 'com.theartofdev.edmodo:android-image-cropper:2.7.0' implementation 'android.arch.persistence.room:runtime:1.1.1' annotationProcessor 'android.arch.persistence.room:compiler:1.1.1' testImplementation 'android.arch.persistence.room:testing:1.1.1' implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1' implementation 'com.squareup.retrofit2:retrofit:2.3.0' implementation 'com.squareup.retrofit2:converter-gson:2.3.0' implementation 'com.github.bumptech.glide:glide:4.9.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0' }
- Add the following in the launcher activity.
Intent intent= new Intent(context,DocScanActivity.class); intent.putExtra("eid",eid); intent.putExtra("clientid",clientid); intent.putExtra("clientsecret",client_secret); intent.putExtra(“sub”,subValue); // passing the subValue is “sdk” intent.putExtra(“appThemeColor”,apptheme); intent.putExtra(“magicfilter”,magicfilter); intent.putExtra(“sizepreference”,sizepreference); intent.putExtra(“appType,appType); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);
You have successfully integrated the Ephesoft Mobile SDK with your Android applications.
Implementation for iOS
Perform the following steps to add the Ephesoft Mobile SDK to an iOS project:
- Open iOS application in Xcode.
- Click the General tab.
- Click the plus (+) icon under Embedded Binaries.
- Click Add Other. Select MobileRefresh.framework.
Figure 7. Framework Path in Xcode Application
- Click Framework Search Paths to ensure the framework path is successfully added.
- Click Build Settings.
- Select the Enable Bitcode.
- Select No in the drop-down menu.
Figure 8. Enable Bitcode Drop-Down Menu
- Add Import MobileRefresh to the top of the ViewController file. Refer to the figure below as an example.
Figure 9. Example Location to Add Import MobileRefresh
- Launch the Ephesoft Mobile SDK using the following code:
let scannerViewController = DocumentScannerViewController( delegate: self, eid: "Write_Your_EID_Value", clientId: "Write_Your_Client_ID_Value", clientSecret: "Write_Your_Client_Secret_Value",batchId:"Default", magicFilter:"0", sizePreferences:"Large",appType:"Product",subValue:”sdk”) present(scannerViewController, animated: true)
11. In the ViewController file, conform to the DocumentScannerViewControllerDelegate protocol as shown below:
class ViewController: DocumentScannerViewControllerDelegate
12. Implement the following delegate method to the ViewController file. This returns an error message if a problem occurs when launching the Ephesoft Mobile SDK.
func imageScannerController(_ scanner: DocumentScannerViewController, didFailWithError error: Error) { print(error) }
Note: Ephesoft Mobile will need access to the phone’s camera and Photo Library. We recommend updating the info.plist file in your iOS application to include Privacy – Photo Library Description and Privacy – Camera Usage Description entries to inform your mobile users.
You have successfully integrated the Ephesoft Mobile SDK into your iOS applications.
Mobile API
The following APIs are used in both iOS and Android SDKs.
- SDK Authorization
- End Point: https://api.us.ephesoftmobile.com/mobile-refresh/api/authorizersdk
- This API is used for SDK authorization. Pass the EID, Client ID, and Client Secret values. The API authorizes the SDK at launch and returns an access token value, which is used at the time of the file submission to Ephesoft Transact.
Note: The EID, Client ID, and Client Secret values are provided by your organization’s Ephesoft Mobile administrator.
- Submit Files to Ephesoft Transact
- End Point: https://api.us.ephesoftmobile.com/mobile-refresh/api/presigneds3url
- This API request returns a unique pre-signed Amazon S3 bucket URL, where all files are submitted to Ephesoft Transact.
- Refresh Authorization Access Token
- End Point: https://api.us.ephesoftmobile.com/mobile-refresh/api/authorizationrefreshtoken
- Use this API to access the SDK when the access token has expired and when the API returns a response related to token expiration.
For more information about Web Service APIs used in Ephesoft Transact 2019.1 or above, refer to the Ephesoft Mobile Swagger page.
Conclusion
After completing this guide for Android or iOS integration, you can now use Ephesoft Mobile on your respective mobile applications.