I am using LVL for my paid application. LVL working fine when I uploaded my app in market and published. But due to some causes I unpublished that application. Now I am facing this problem, that LVL returns not licensed message even

  • My app present in draft (in developer account)
  • My test account present in Test accounts with Test response with LICENCED .

What should be solution?

Here is my code :

public class LVLChecker extends Activity {

    private static final String BASE64_PUBLIC_KEY = HERE_IS_MY_PUBLIC_BASE_KEY;
    // Generate 20 random bytes, and put them here.
    private static final byte[] SALT = new byte[] {-46, 105, 60, -128, -103, -57, 64, -64, 51, 88,
        -95, -45, 77, -119, -36, -113, -11, 32, -64, 99};
    private LicenseCheckerCallback mLicenseCheckerCallback;
    private LicenseChecker mChecker;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.welcome_screen);

        // Try to use more data here. ANDROID_ID is a single point of attack.
        String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
        // Library calls this when it's done.
        mLicenseCheckerCallback = new MyLicenseCheckerCallback();
        // Construct the LicenseChecker with a policy.
        mChecker = new LicenseChecker(
            this, new ServerManagedPolicy(this,
                new AESObfuscator(SALT, getPackageName(), deviceId)),
            BASE64_PUBLIC_KEY);
        doCheck();
    }

    protected Dialog onCreateDialog(int id) {
        // We have only one dialog.
        return new AlertDialog.Builder(this)
            .setTitle(R.string.unlicensed_dialog_title)
            .setMessage(R.string.unlicensed_dialog_body)
            .setPositiveButton(R.string.buy_button, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
                        "http://market.android.com/details?id=" + getPackageName()));
                    startActivity(marketIntent);
                    finish();
                }
            })
            .setNegativeButton(R.string.quit_button, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    finish();
                }
            })
            .create();
    }

    private void doCheck() {
        setProgressBarIndeterminateVisibility(true);
        mChecker.checkAccess(mLicenseCheckerCallback);        
    }

    private class MyLicenseCheckerCallback implements LicenseCheckerCallback {
        public void allow() {
            if (isFinishing()) {
                // Don't update UI if Activity is finishing.
                return;
            }
            // Should allow user access.
            //Log.w("LicenseChecker", "Allow");
            Intent intent = new Intent().setClass(LVLChecker.this, WelcomeActivity.class);           
            startActivity(intent);
            finish();
        }

        public void dontAllow() {
            Log.i("LVL Testing", "dontAllow() called");
            if (isFinishing()) {
                // Don't update UI if Activity is finishing.
                return;
            }
            // Should not allow access. In most cases, the app should assume
            // the user has access unless it encounters this. If it does,
            // the app should inform the user of their unlicensed ways
            // and then either shut down the app or limit the user to a
            // restricted set of features.
            // Currently, we show a dialog that takes the user to Market.
            showDialog(0);
        }

        public void applicationError(ApplicationErrorCode errorCode) {
            if (isFinishing()) {
                // Don't update UI if Activity is finishing.
                return;
            }
            // This is a polite way of saying the developer made a mistake
            // while setting up or calling the license checker library.
            // Please examine the error code and fix the error.
            String result = String.format(getString(R.string.application_error), errorCode);
            Toast.makeText(LVLChecker.this, result, Toast.LENGTH_SHORT).show();
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mChecker.onDestroy();
    }
}
link|flag

Know someone who can answer? Share a link to this question via email, twitter, or facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.