Question

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')
    }
Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top