Configure the SDK
Android
In order to use MobbSign Android SDK in your (native Android) application you must follow these steps:
Include the sdk library (mobbsign-sdk-android-3.x.x.aar and mobb-commons-android-1.x.x.aar) by copying it to your application’s libs folder and add this line (change it to the correct version) to your build.gradle file (dependencies section):
dependencies { … compile group: 'com.mobbeel', name: 'mobbsign-sdk-android', version: “3.3.x” compile group: 'com.mobbeel', name: 'mobb-commons-android', version: “1.3.x” // 3rd party libraries compile 'com.madgag.spongycastle:prov:1.54.0.0' compile 'com.madgag.spongycastle:pkix:1.54.0.0' compile group: 'com.squareup.retrofit2', name: 'retrofit', version: '2.1.0' }
Add a flatDir repository to your build.gradle file so that gradle can find the “aar” files in your libs folder:
repositories { mavenCentral() flatDir { dirs 'libs' } }
Add internet and write external storage permissions in the AndroidManifest.xml of your project (the first is needed to check license and the second to store temporary files during signature process)
Permissions:
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
It’s highly recommended to include the following option in your application tag of the AndroidManifest.xml file:
<application android:largeHeap="true" ...
Create your MobbSignView in your Activity. You can choose to create the view in your own layout xml file or doing it programmatically.
On layout.xml file:
<com.mobbeel.mobbsign.view.MobbSignView android:id="@+id/mobbsignview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:scrollbars = "vertical|horizontal"/>
Programmatically:
mobbSignView = new MobbSignView(this, null); setContentView(mobbSignView);
iOS
Include the sdk framework (MobbSignSDK.framework, MobbSignSDK.bundle, MobbCommons.framework, PDFNet.framework along with Tools.framework) from the libs folder of the zip in your project by copying it to a folder within your project and then drag and drop it to your project tree in XCode.
Add PDFNet.framework and Tools.framework to the Embedded Binaries section of your target:
Add the following frameworks to your target link libraries:
- UIKit.framework
- Foundation.framework
- CFNetwork.framework
- CoreGraphics.framework
- CoreText.framework
- QuartzCore.framework
- Security.framework
- libz.dylib
- libxml2.dylib
Add the -lstdc++, -lsqlite3 and -ObjC flags to the Other Link Flags option on your project Build Settings.
In your target's build phases, add a new run script phase (by clicking on the '+'), and add the following script:
bash "$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/PDFNet.framework/strip-framework.sh"
- Create your MobbSignView in your ViewController.
- (void)viewDidLoad
{
[super viewDidLoad];
CGRect wholeWindow = [self.view bounds];
MobbSignView* mobbSignView = [[MobbSignView alloc] initWithFrame:wholeWindow];
[self.view addSubview:mobbSignView];
}
Alternatively, you can customize the MobbSignView by setting up a customization dictionary and using it on the initialization:
- (void)viewDidLoad
{
[super viewDidLoad];
CGRect wholeWindow = [self.view bounds];
NSMutableDictionary * customDict = [[NSMutableDictionary alloc] init];
[customDict setObject:[UIColor redColor] forKey:kMobbSign_SIGNATURE_STROKE_COLOR];
MobbSignView *mobbSignView = [[MobbSignView alloc] initWithFrame:wholeWindow customizationDictionary:customDict];
}
- If you are using iOS 13 or above please make sure to configure the presentation style of the ViewController that contains MobbSign to fullScreen:
[viewController setModalPresentationStyle: UIModalPresentationFullScreen];
Windows Metro Apps
In order to use MobbSign Windows SDK in your (native Windows Store) application you must follow the following steps:
Include the Sdk Visual Studio Extension (MobbSignW81.vsix) from the libs folder of the zip in your project by executing it and following the steps of the installer. Once installed, right click on your project in “Solution Explorer -> Add Reference… -> Windows -> Extensions” and select “MobbSign SDK for Windows Store apps”.
To check if the extension has been successfully referenced, in the References folder of your project you could see the extension “MobbSign for Windows Store apps”. If at this point, there is a small yellow exclamation mark on the "MobbSign for Windows Store Apps" reference, that means you need to change architecture from "Any CPU" to either "ARM", "x86" or "x64".
Create your MobbSignView in your Page, and add it as a children of your page main container.
public MainPage()
{
this.InitializeComponent();
this.MobbSignView = new MobbSignView();
this.LayoutRoot.Children.Add(MobbSignView);
}
SDK Example
See the section SDK Example for more info.