androidandroid-studioandroid-lvl

LicenseCheckerCallback response issue


I integrated License Verification Library in my Android application. But the license checker callback does not call any of the methods: allow(), dontAllow() or applicationError(). When i turn internet off, it displays the appropriate dialog, which means dialogs are working, but I get a blank white screen when response is received. The logcat output says I/LicenseChecker: Received response. Clearing timeout. and nothing happens after that. Below is the code:

public class SettingsActivity extends Activity {

private static final String BASE64_PUBLIC_KEY = "key";


private static final byte[] SALT = new byte[] {random};


private LicenseCheckerCallback mLicenseCheckerCallback;
private LicenseChecker mChecker;
...

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    String deviceId = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);

    mLicenseCheckerCallback = new MyLicenseCheckerCallback();
    mChecker = new LicenseChecker(
            this, new ServerManagedPolicy(this,
            new AESObfuscator(SALT, getPackageName(), deviceId)),
            BASE64_PUBLIC_KEY);

    mChecker.checkAccess(mLicenseCheckerCallback);
}
....
private class MyLicenseCheckerCallback implements LicenseCheckerCallback {
        @Override
        public void allow(int reason) {
            if (isFinishing()) {
                return;
            }
            displayResult(getString(R.string.allow));
        }

        @Override
        public void dontAllow(int reason) {
            if (isFinishing()) {
                return;
            }
            displayResult(getString(R.string.dont_allow));
        }

        @Override
        public void applicationError(int errorCode) {
            if (isFinishing()) {
                return;
            }
            displayResult(/*result*/);
        }
    }
}

This thread seems to address the exact same problem but nobody seems to have resolved it: LicenseCheckerCallback not calling

Also, currently I am testing the app for non-licensed copy check. For testing licensed copy i will have to put it up on the play store which is another thing.

Has anybody faced similar problems with the LicenseChecker response?


Solution

  • I figured it out. It has to do with the app versioning.