Questions à propos de LicenceChecker
Bonjour,
J'ignore ce que c'est, mais il faut que je l'implémente dans mes projets.
Bon apparemment c'est un système qui permet de vérifier que l'utilisateur à bien acheter son application.
J'ai importé :
android-sdks\extras\google\play_licensing\library
android-sdks\extras\google\play_licensing\sample
library est une librairie.
sample utilise cette librairie..
J'ai remplacé la valeur de :
Code:
private static final String BASE64_PUBLIC_KEY
Par ma clé.
Apparemment le téléphone que j'utilise correspond à l'adresse eMail qu'il faut.
Quand je clique sur Check licence j'ai : Application error: 3.
Avec Licence Test Response = Respond normally, mais si je met n'importe quoi d'autre ça répond pareil.
J'ai essayé de mettre ça dans mon projet :
Code:
1 2 3 4
| private static final String BASE64_PUBLIC_KEY = "";
private LicenseCheckerCallback mLicenseCheckerCallback;
private LicenseChecker mChecker;
private static final byte[] SALT = new byte[] {-46, 65, 30, -128, -103, -57, 74, -64, 51, 88, -95, -45, 77, -117, -36, -113, -11, 31, -64, 89}; |
Code:
1 2 3 4 5 6 7 8 9 10
| mLicenseCheckerCallback = new MyLicenseCheckerCallback();
String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
mChecker = new LicenseChecker(
this, new ServerManagedPolicy(this,
new AESObfuscator(SALT, getPackageName(), deviceId)),
BASE64_PUBLIC_KEY);
mChecker.checkAccess(mLicenseCheckerCallback); |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| private class MyLicenseCheckerCallback implements LicenseCheckerCallback {
public void allow(int policyReason) {
if (isFinishing()) {
return;
}
Log.v("MyLicenceCheckerCallback", "Should allow user access : "+policyReason);
}
public void dontAllow(int policyReason) {
if (isFinishing()) {
return;
}
Log.v("MyLicenceCheckerCallback", "Should not allow user access : "+policyReason);
}
public void applicationError(int errorCode) {
if (isFinishing()) {
return;
}
Log.v("MyLicenceCheckerCallback", "The developer made a mistake : "+errorCode);
}
} |
Et là c'est pareil, j'ai The developer made a mistake : 3.
Est-ce que vous savez ce que l'erreur 3 signifie ?
Si vous avez des infos sur la vérification de licence.
La doc est bien documenté, voir trop peut être, c'est trop beaucoup trop long.
Merci.