Licensing My Application


  1. Leolicos

    Leolicos Well-Known Member

    The sample application doesn't work for me... It crashes both in my emulator and on my G1 before it's even able to load the layout. I'm also not sure what it really does... I read the "Licensing your application" part on the site doc, but I'm still confused what really goes on and why it's important.

    Advertisement
  2. Leolicos

    Leolicos Well-Known Member

    So I figured out why it was crashing... I didn't notice that I had to put my public key where it obviously said "PUT YOUR PUBLIC KEY HERE". Other than that it works now.

    My next question is what part do I actually need to put in my application from the sample? Do I need the whole MainActivity Activity and have that run first? Or should I just add a certain port of the activity?

    My guess is making that Activity just a normal class (NOT extending activity, so there's no onCreate, but instead a constructor), and put everything that's in onCreate() but in the constructor

    Code (Text):
    1.  
    2. public class MyLicense
    3. {
    4.    public MyLicense()
    5.    {
    6.         mHandler = new Handler();
    7.  
    8.         // Try to use more data here. ANDROID_ID is a single point of attack.
    9.         String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
    10.  
    11.         // Library calls this when it's done.
    12.         mLicenseCheckerCallback = new MyLicenseCheckerCallback();
    13.         // Construct the LicenseChecker with a policy.
    14.         mChecker = new LicenseChecker(
    15.             this, new ServerManagedPolicy(this,
    16.                 new AESObfuscator(SALT, getPackageName(), deviceId)),
    17.             BASE64_PUBLIC_KEY);
    18.         doCheck();
    19.     }
    20.     // ... all other functons in the sample's code
    21.  
    Does that do everything I need to do for license checking?

    Do I need all that?
  3. MrGreg

    MrGreg Well-Known Member

    I implemented this licensing in my app, and it seems super slow to me. Specifically, the AESObfuscator generates a secret key, and it is slow on my Hero (on the order of several seconds).

    Is anyone else experiencing this? Thanks!
Loading...

Share This Page