SlideLock




Updated May 3, 2012

SlideLock2 is a lightweight standalone licensing module created and maintained by SlideME LLC ™ in order to help developers protect their applications from being redistributed freely. Our initiative was to help developers protect their applications due to the lack of minimal Digital Right Management in the Android Platform.

The new version was completely rewritten in order to provide better guarantees to application owners and increase the trust of the community in our engagement into the service, while offering the developers a more flexible way of integrating it into existing and future applications. This version first of all comes with advanced security.

In addition, the SlideLock2 module provides a clear and easy-to-use contract, and also independence of networking, but for the moment the back-end is not fully qualified to support the complete functionality of the API. By default, it offers the (only) option to pull the license directly from SlideME Licensing Service, and does let the developer to reuse an already downloaded license, in order to avoid redundant network traffic. This hotspot for reusing the license demonstrates the offline usage of the License Module, thus, in order to grant offline license, first of all SlideME will have to provide alternative ways of distributing License (maybe we will grant Developers access to generating license through a management page, so they can offer alternatives for 3rd parties such as testers, partners, etc.).

Quick Start Guide

You can download SlideME Demo (v2) to quickly accommodate with how SlideLock2 can be integrated in your application.
The demo contains functionality for storing the license on the filesystem and re-using it for a predefined period of time. It also demonstrates basic functionality for trial time-elapse shutdown of the application, and interacts with SAM to show your application.
Note: We introduced demonstrative licenses in SlideME Servers, meaning that if you use the reserved "SlideLockDemo" within your application, SlideMe License server will return you valid license for any device - this way you can test the end-to-end functionality. There is a checkbox option "Provide a Key and enable SlideLock Test Mode" from within your application profile.
Also for emulators (IMEI 00000..00), license will be granted. This is for testing purpose only. If you want to test negative cases, just use invalid SlideLock keys, and

1) Get the latest slock2 jar and add it to your project.

2) Choose a difficult to reproduce SlideLock Key, between 8-32 alpha-numeric characters (this will be validated for uniqueness upon stocking of your application)
This remains the same as version 1.x

3) You will require networking to pull the license from SlideME Licensing server.

Add the following permission to your AndroidManifest.xml file, to be able to fetch the license :

    <uses-permission android:name="android.permission.INTERNET"/>

4) SlideLock2 is based on device identity. When IMEI is missing, WiFi MAC Address is being used.

Add the following permission to your AndroidManifest.xml file:

        <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
        <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

5) Example how to use com.slideme.slidelock.License :

	/*
	* Obtain application context
	*/
	Context myContext = myActivity.getApplicationContext();

	/*
	* Create a License object. 
	*/
    com.slideme.slidelock.License myLicense = 
        new com.slideme.slidelock.License("My first license", 
                                          "mySlideLockKey from step #2",
                                           myContextOrActivityInstance);

	/*
	* There are other constructors available also, the one in this example
	* is just the most comfortable to use.
	*
	* If you wish use the alternative constructors, you will have to provision
	* the business model objects yourself.
	* 
	* Here's how you can obtain them:
	* 
	* WifiManager aWifiManager = 
	 (WifiManager) myContext.getSystemService(Context.WIFI_SERVICE);
	* TelephonyManager aTelephonyManager =
	  (TelephonyManager)myContext.getSystemService(Context.TELEPHONY_SERVICE);
	* ContentResolver aContentResolver = myContext.getContentResolver();
	*/
	
    try{
        /* 
        *  You can store the fetched data in a persistent storage and retrieve 
        *  it from there on the next application startup, just in case you 
        *  want to save the end-user's networking traffic and reduce startup 
        *  delays. We strongly recommend you to refresh the license from 
        *  time to time, just in case the end-user claims a refund, or any 
        *  other corner case scenario
        */
        myLicense.digest(myLicense.fetch());
    } catch(IOException ioe){
        // license couldn't initialize. Handle this
    }

    Rights someRights = myLicense.getFullRights();
    // Works even if you already reserved the SlideLock Key in the past.
.
    if(someRights != null){
        // you have granted rights.
    } else {
        // You don't have any rights for the feature in cause. Try
        // some features. (Currently not supporting multiple 'features')
    }

Note:
If you want to test it against an emulator, use the example below.
Do keep in mind that this will not work on-device.
You will have to use myLicense.fetch() method from the API,
to retrieve the license for a real successful purchase.


	
    com.slideme.slidelock.License myLicense = 
        new com.slideme.slidelock.License("My fine-grained sample license", 
                                          "TestAppUID",
                                           myContextOrActivityInstance);

    try{
        /* 
        * This string representation of your license will work on emulators 
        * with IMEI 000000000000000 retrievable via TelephonyManager
        */
        myLicense.digest(("bf71ff75377f529bafc33fc0101fee94:"+
                          "97b315c743bf8b962043876ed04855fe\n"+
                          "3cccbf20faadf4a0a5977a483ba45757:"+
                          "bf8ad256d69fa98b9facca6fb43cb233").getBytes());
    } catch(IOException ioe){
        // license couldn't initialize. Handle this
    }

    Rights someRights = myLicense.getFullRights();
.
    if(someRights != null){
        // you have granted rights.
    } else {
        // This shouldn’t happen. Track your device IMEI to match.
    }

      someRights = myLicense.getRights("TestFeature");
      // This is a sample for a grained permission. Should work as well.

6) Take a look at the License JavaDoc jdoc_02052012.zip to figure out more details and how you can improve your licensing.

7) Generate your apk and upload it to the SlideME Marketplace, making sure to fill in your slidelock key into the form.

Notes and suggestions:

Since it is in the developer control to customize and use the SlideME License Module in order to fit to their need at a highest efficiency, we do recommend keeping in mind the following:

1) You can go for so many license validation procedures, such as validating the app on first runtime - “One-Time Check” (this will be transformed into Serial Key licensing in future), at every startup (this is how the previous version of SlideLock enforced the check) on a weekly basis – “Periodic validation”, on a custom interval basis – from X to X days, or even based on more complex rules.

However, you will have to keep in mind that your users may be traveling, that means they will most likely be in roaming and/or may not use networking, so your license fetch/refresh will not work. In this case you could go for a predefined grace period, for example (let’s say you let the end-user use the app for X extra days even if you can’t fetch the license during this period).

2) When you publish your application, make sure to inform your clients of your application’s policies related to how you integrated the license, otherwise you may lose potential clients.

Linking your apps with SlideME

AttachmentSize
slock2_02052012.jar8.04 KB
jdoc_02052012.zip20.31 KB
SlideMEDemo_v2_20120503.zip39.63 KB