I developed an application that became very popular, and someone hacked it. I would like to know if anyone knows first of all: how? If someone knows a workaround to avoid this. The app uses an in-app purchase in accordance with Googleβs example to unlock some of the premium features as follows:
private IabHelper mHelper;
if (!isPro(getActivity())) {
mHelper = new IabHelper(getActivity(), KKK);
mHelper.enableDebugLogging(true);
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
return;
}
if (mHelper == null) return;
mHelper.queryInventoryAsync(mGotInventoryListener);
}
});
}
IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
if (mHelper == null) return;
if (result.isFailure()) {
return;
}
Purchase pro = inventory.getPurchase(PRO_STRING);
SettingsProvider.putSecBoolean(getActivity(), "pro", pro != null && verifyDeveloperPayload(pro));
}
};
IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener = new IabHelper.OnIabPurchaseFinishedListener() {
public void onIabPurchaseFinished(IabResult result, Purchase purchase) {
if (mHelper == null) return;
if (result.isFailure()) {
return;
}
if (purchase.getSku().equals(PRO_STRING)) {
SettingsProvider.putSecBoolean(getActivity(), "pro", true);
}
}
};
boolean verifyDeveloperPayload(Purchase p) {
String payload = p.getDeveloperPayload();
return true;
}
@Override
public void onDestroy() {
super.onDestroy();
if (mHelper != null) {
mHelper.dispose();
mHelper = null;
}
}
and for the purchase process:
mPro.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RandomString randomString = new RandomString(36);
String payload = randomString.nextString();
if (mHelper != null) mHelper.flagEndAsync();
mHelper.launchPurchaseFlow(getActivity(), PRO_STRING,
IabHelper.ITEM_TYPE_INAPP, RC_REQUEST,
mPurchaseFinishedListener, payload);
}
});
Well, someone somehow hacked it. This means that the content available in the pro version is free without payment. Maybe someone can share their experience and suggest some way to avoid this?
And also does anyone know how to do this? Thanks