After Googling I have found that my free app with ads is published in some sites with title "app_name_ad_free_mod_hacked", after trying to install this app in my personal phone it is working correctly but ads aren't showing. Even, I noticed that it doesn't make ad request.
Is there any solution to prevent the app from being modified?
P.S: I'm using ProGuard and I have decompiled the modified APK, and I don't notice any difference from original app.
Ads are initialized in my code as below :
At onCreate()
of MainActivity
:
MobileAds.initialize(getApplicationContext(), "admob_app_id");
mAdView = findViewById(R.id.adView_fragment_ads);
layout_ads = findViewById(R.id.layout_fragments_ads);
start_ad();
and the method :
private void start_ad() {
try {
if (data_ne_db[0].equals("jo")) {
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice(getResources().getString(R.string.ads_test_device))
.addTestDevice(getResources().getString(R.string.ads_test_device_facebook))
.build();
//mAdView.setAdUnitId(getResources().getString(R.string.ads_kryesorja_poshte));
//mAdView.setAdSize(AdSize.LARGE_BANNER);
mAdView1.loadAd(adRequest);
mAdView1.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
mAdView1.resume();
mAdView1.setVisibility(View.VISIBLE);
u_inicializua = true;
}
@Override
public void onAdClosed() {
Log.e("ADDD CLOSEEEED", "Ads is closed by user)");
}
@Override
public void onAdFailedToLoad(int errorCode) {
mAdView1.pause();
Log.e("AD FRAG 2", "Ads failed to load" + " error : " + errorCode);
u_inicializua = false;
}
@Override
public void onAdLeftApplication() {
}
@Override
public void onAdOpened() {
}
});
}
} catch (Exception ignored) {}
}
Maybe someone just injects comment to the method call or in the database if check, but how to prevent that?
Making hacking impossible: I don't know if there is an answer.
What you can do is: There are some paid tools like dexguard. You can use them. A paid alternative will likely work better than a free one.
Though, an expert one might get into your code. But, cracking dexguard isn't a simple game. Also, it does Runtime Self Protection, Code optimization, etc
Some of my unused ideas::-P | Client Side
That means: Class ABACAS will do SACABA and SACABA will do ABACAS & method delegate will return stack and method stack will return delegate
If your app is server-dependent (I mean your app is just is a client, the server does the task, has API and does send-receive). Just ask your app for the signature from the server. If the signatures match does next, else return.