Reputation: 1706
How to get the expansion file URL from google play to download the file if the user has deleted the expansion file.
Upvotes: 0
Views: 97
Reputation: 1706
You must use the LicenseChecker
to get the expansion file URL, Name or Size.
private LicenseChecker mChecker;
private String expFileUrl;
On the MainActivity
use this Methode:
private void setLicenseChecker() {
String deviceId = android.provider.Settings.Secure.getString(this.getContentResolver(),
android.provider.Settings.Secure.ANDROID_ID);
final APKExpansionPolicy aep = new APKExpansionPolicy(this,
new AESObfuscator(SALT, this.getPackageName(), deviceId));
// reset our policy back to the start of the world to force a
// re-check
aep.resetPolicy();
// let's try and get the OBB file from LVL first
// Construct the LicenseChecker with a Policy.
mChecker = new LicenseChecker(this, aep,BASE64_PUBLIC_KEY);
mChecker.checkAccess(new LicenseCheckerCallback() {
@Override
public void allow(int reason) {
expFileUrl=aep.getExpansionURL(0);
Log.d(LOG_TAG, "Obb name:"+aep.getExpansionFileName(0));
Log.d(LOG_TAG, "Obb size:"+aep.getExpansionFileSize(0));
Log.d(LOG_TAG, "Obb Url:"+aep.getExpansionURL(0));
Log.d(LOG_TAG, "Obb Count:"+aep.getExpansionURLCount());
}
@Override
public void dontAllow(int reason) {
}
@Override
public void applicationError(int errorCode) {
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
mChecker.onDestroy();
}
Upvotes: 0