Connexion utilisateur

slidelock License problem

I tried to include slidelock but I got below error. No sure on what to do.

01-17 22:57:26.750: E/AndroidRuntime(2548): FATAL EXCEPTION: main
01-17 22:57:26.750: E/AndroidRuntime(2548): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app/com.example.app.MainActivity}: java.lang.IllegalArgumentException: Invalid license
01-17 22:57:26.750: E/AndroidRuntime(2548): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2353)
01-17 22:57:26.750: E/AndroidRuntime(2548): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2403)
01-17 22:57:26.750: E/AndroidRuntime(2548): at android.app.ActivityThread.access$600(ActivityThread.java:154)
01-17 22:57:26.750: E/AndroidRuntime(2548): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1270)
01-17 22:57:26.750: E/AndroidRuntime(2548): at android.os.Handler.dispatchMessage(Handler.java:99)
01-17 22:57:26.750: E/AndroidRuntime(2548): at android.os.Looper.loop(Looper.java:137)
01-17 22:57:26.750: E/AndroidRuntime(2548): at android.app.ActivityThread.main(ActivityThread.java:5302)
01-17 22:57:26.750: E/AndroidRuntime(2548): at java.lang.reflect.Method.invokeNative(Native Method)
01-17 22:57:26.750: E/AndroidRuntime(2548): at java.lang.reflect.Method.invoke(Method.java:525)
01-17 22:57:26.750: E/AndroidRuntime(2548): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
01-17 22:57:26.750: E/AndroidRuntime(2548): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
01-17 22:57:26.750: E/AndroidRuntime(2548): at dalvik.system.NativeStart.main(Native Method)
01-17 22:57:26.750: E/AndroidRuntime(2548): Caused by: java.lang.IllegalArgumentException: Invalid license
01-17 22:57:26.750: E/AndroidRuntime(2548): at com.slideme.slidelock.License.digest(License.java:234)
01-17 22:57:26.750: E/AndroidRuntime(2548): at com.example.app.MainActivity.onCreate(MainActivity.java:450)
01-17 22:57:26.750: E/AndroidRuntime(2548): at android.app.Activity.performCreate(Activity.java:5203)
01-17 22:57:26.750: E/AndroidRuntime(2548): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)

Basically, I just followed the example:

StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
Context myContext = this.getApplicationContext();
com.slideme.slidelock.License myLicense =
new com.slideme.slidelock.License("App",
"key",//
myContext);
try{
myLicense.digest(myLicense.fetch());
} catch(IOException ioe){

}

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

slidelock License problem

You are getting an "Invalid license" (IllegalArgumentException) in line myLicense.digest(myLicense.fetch()); because myLicense.fetch() probably isn't fetching a proper licenseBinary (null or 0 length). Have you initialized you License instance (myLicense) with a valid SlideLockKey? Have you added the needed permissions (from here http://slideme.org/slidelock) in your manifest and have internet connectivity?

Take a look at LicenseCheckAsyncTask from SlideLock Demo project for some hints in error handling such cases.