public class LicenseChecker extends Object implements android.content.ServiceConnection
The LicenseChecker is configured via a Policy which contains the
logic to determine whether a user should have access to the application. For
example, the Policy can define a threshold for allowable number of server or
client failures before the library reports the user as not having access.
Must also provide the Base64-encoded RSA public key associated with your developer account. The public key is obtainable from the publisher site.
| Constructor and Description |
|---|
LicenseChecker(android.content.Context context,
Policy policy,
String encodedPublicKey) |
| Modifier and Type | Method and Description |
|---|---|
void |
checkAccess(LicenseCheckerCallback callback)
Checks if the user should have access to the app.
|
void |
onDestroy()
Inform the library that the context is about to be destroyed, so that any
open connections can be cleaned up.
|
void |
onServiceConnected(android.content.ComponentName name,
android.os.IBinder service) |
void |
onServiceDisconnected(android.content.ComponentName name) |
public LicenseChecker(android.content.Context context,
Policy policy,
String encodedPublicKey)
context - a Contextpolicy - implementation of PolicyencodedPublicKey - Base64-encoded RSA public keyIllegalArgumentException - if encodedPublicKey is invalidpublic void checkAccess(LicenseCheckerCallback callback)
NOTE: This call uses a trivially obfuscated string (base64-encoded). For best security, we recommend obfuscating the string that is passed into bindService using another method of your own devising.
source string: "com.android.vending.licensing.ILicensingService"
callback - public void onServiceConnected(android.content.ComponentName name,
android.os.IBinder service)
onServiceConnected in interface android.content.ServiceConnectionpublic void onServiceDisconnected(android.content.ComponentName name)
onServiceDisconnected in interface android.content.ServiceConnectionpublic void onDestroy()
Failure to call this method can result in a crash under certain circumstances, such as during screen rotation if an Activity requests the license check or when the user exits the application.
Copyright © 2012–2014 simpligility technologies inc.. All rights reserved.