com.google.android.vending.licensing.LicenseChecker Java Examples

The following examples show how to use com.google.android.vending.licensing.LicenseChecker. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java    From text_converter with GNU General Public License v3.0 5 votes vote down vote up
private void checkLicense() {
    mHandler = new Handler();
    Policy policy = PolicyFactory.createPolicy(this, getPackageName());
    mChecker = new LicenseChecker(this, policy, Key.BASE_64_PUBLIC_KEY);
    mCallBack = new CheckLicenseCallBack();
    mChecker.checkAccess(mCallBack);
}
 
Example #2
Source File: MainActivity.java    From play-licensing with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.main);

    mStatusText = (TextView) findViewById(R.id.status_text);
    mCheckLicenseButton = (Button) findViewById(R.id.check_license_button);
    mCheckLicenseButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            doCheck();
        }
    });

    mHandler = new Handler();

    // Try to use more data here. ANDROID_ID is a single point of attack.
    String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);

    // Library calls this when it's done.
    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();
}