Android Licensing Library Alternatives [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this questionI currently am using the licensing library in one of my apps. A lot of my users are complaining that the dialog tells them the app isn't licensed, when they paid for it.
A bad data connection is the issue: I myself have even got it on wifi. I noticed that I can open rom manager while in air plane mode;
So what are my alternatives? Ii'd like to switch to something that doesn't bother my customers so much but still protects my apps.
I set it up using the link below http://www.droidforums.net/forum/android-app-developers/69899-market-license-easy-implementation-protect-your-apps.html
You can still use the Google's library but use a custom ServerManagedPolicy. The default ServerManagedPolicy will make request to the license server to check if the user is licensed, if it is licensed it will store a copy of the license locally (via preferences). But this local copy has an expiry date, and after it expires it will again make another call to the license server to recheck. All you need to do is modify this policy to have a longer expiry date. You still need an internet connection when you first run the app, but most likely the user will have it since he bought the app.
The change is easy, make it in this method, in the if licensed statement, just use current date + one month for example. Currently the code will use an expiry date that the license server sends.
public void processServerResponse(LicenseResponse response, ResponseData rawData) {
// Update retry counter
if (response != LicenseResponse.RETRY) {
setRetryCount(0);
} else {
setRetryCount(mRetryCount + 1);
}
if (response == LicenseResponse.LICENSED) {
// Update server policy data
Map<String, String> extras = decodeExtras(rawData.extra);
mLastResponse = response;
setValidityTimestamp(extras.get("VT")); //MAKE CHANGE HERE
setRetryUntil(extras.get("GT"));
setMaxRetries(extras.get("GR"));
} else if (response == LicenseResponse.NOT_LICENSED) {
// Clear out stale policy data
setValidityTimestamp(DEFAULT_VALIDITY_TIMESTAMP);
setRetryUntil(DEFAULT_RETRY_UNTIL);
setMaxRetries(DEFAULT_MAX_RETRIES);
}
setLastResponse(response);
mPreferences.commit();
}
精彩评论