Этим утром мои почтовые ящики были заполнены пользователями, получающими ошибки проверки лицензии для одного из моих платных приложений. Лицензирование для приложения работало нормально в течение последних 5 лет.
К сожалению, я не смог воспроизвести проблему ...
Используется старый LVL из пакета Google = "com.google.android.vending.licensing"
private class MyLicenseCheckerCallback implements LicenseCheckerCallback {
// Means: GooglePlay believes this user is legitimate
@Override
public void allow(int x, int policyReason, String y) {
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
try { mProgressDialog.dismiss(); mProgressDialog = null; } catch (Exception e) {e.printStackTrace(); }
}
});
// Update server
Util.pingServer(getApplicationContext());
}
// Means: Google Play definitely thinks this version is a pirate version
@SuppressWarnings("SpellCheckingInspection")
public void dontAllow(int x, final int policyReason, String y) {
EventLog.i(TAG, "don't Allow: " + policyReason);
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
try { mProgressDialog.dismiss(); mProgressDialog = null; } catch (Exception e) {e.printStackTrace(); }
showGoogleLicenseDialog(policyReason == Policy.RETRY ? 1 : 0);
}
});
}
// Means: Developer has not setup licensing properly
// ERROR_NOT_MARKET_MANAGED: not managed by Android Market (now called Google Play)
// More specifically, the version X of your application is not uploaded or published in Google Play
public void applicationError(final int errorCode) {
EventLog.e(TAG, "applicationError: " + errorCode);
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
try { mProgressDialog.dismiss(); mProgressDialog = null; } catch (Exception e) {e.printStackTrace(); }
// Developer mistake dialog
String result = String.format(getString(R.string.application_error), errorCode);
ActivityHelper.showToast(MainActivity.this, "License problem: App Error: " + result, Toast.LENGTH_LONG);
}
});
}
}
private final MyLicenseCheckerCallback mMyLicenseCheckerCallback = new MyLicenseCheckerCallback();