Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid license check going straight to applicationError(...)
    text
    copied!<p>I just implemented the android server check in my app. I am using the StrictPolicy method because I may be just a little bitter from the pirated version have 5X the amount of downloads as the version in the market... Anyway, I coded the method basically verbatim into my source code. However, when I toggle the License Test Response on the developer console to Licensed, I get the unlicensed dialog. However, in the applicationError method, dontAllow() is called and when i comment this line out, the unlicensed dialog does not show. What am I doing wrong? Here is my MyLicenseCheckerCallback class. </p> <p>I call doCheck in the onCreate, and again in the onResume.</p> <pre><code>@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mHandler = new Handler(); 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(); setContentView(R.layout.main); ... private void doCheck() { 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. } public void dontAllow() { if (isFinishing()) { // Don't update UI if Activity is finishing. return; } //Be as annoying as possible illegalDownload = new IllegalDownloadHandler(speedy.this); illegalDownload.show(); illegalDownload.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { Intent goToMarket = null; goToMarket = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.TimothyMilla.SpeedBoost")); startActivity(goToMarket); illegalDownload.dismiss(); } }); // Should not allow access. An app can handle as needed, // typically by informing the user that the app is not licensed // and then shutting down the app or limiting the user to a // restricted set of features. // In this example, we show a dialog that takes the user to Market. //showDialog(0); //onDestroy(); } @Override public void applicationError(ApplicationErrorCode errorCode) { // TODO Auto-generated method stub dontAllow(); //when I comment the above line out, the unlicensed dialog is not shown. } private void displayResult(final String result) { mHandler.post(new Runnable() { public void run() { //dontAllow(); Toast.makeText(getApplicationContext(), result, Toast.LENGTH_SHORT).show(); //setProgressBarIndeterminateVisibility(false); } }); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload