views:

24

answers:

1

I'm trying to add SlideLock to my app for a version that I am putting on SlideMe. I am getting an error at mainActivityInstance for some reason and I don't know why. Any ideas what is wrong? Thanks.

public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.home);

    com.slideme.slidelock.License myLicense = 
        new com.slideme.slidelock.License("My first license", 
                                          "4839206850342",
                                          mainActivityInstance);
    // There are other constructors available also. 
    // This one is just the most comfortable.

    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')
    }
A: 

Hello Joshua,

I don't see you declaring the mainActivityInstance variable anywhere. If you are using this code in the Activity#onCreate(Bundle icicle) method, you can try to instantiate SlideLock2 by passing the Activity instance reference directly:

        new com.slideme.slidelock.License("My first license", 
                                      "4839206850342",
                                      this);

Let me know if you have further trouble.

Thank you, -SlideME SlideLock Team

SlideME SlideLock Team
That appears to have done it. Guess well see if it works now. Thanks.
Joshua Sutherland
Ya. Is there anything else that I need to do to get this all to work right? I downloaded my app to test it to make sure that it was working and its not. I'm getting a force close and my logcat is saying that I have an invalid license. So ya. There is some problem. In the slide lock key I have the same key, but its not registering it seems. Any idea what my problem is? Have I forgotten anything? Thanks.
Joshua Sutherland
It will be valid once you purchase the application from SlideME.It is likely that we will consider emulators as "prepaid" for testing purpose, and return valid license for the emulator by default. Currently work is in progress in this area.
SlideME SlideLock Team