[Defy Themes and Apps] [] AL []:
Hi there, here's a little tweak that I've just figured out and that hopefully some of you might enjoy...

But first off,

a disclaimer

:

Ads or (upgrade) nag banners 'sometimes' have a justifiable reason of being. Devs might use them to get some extra (very small un fact; most finally give this up in the end) revenue from them. That, in turn, that might allow or encourage them to continue pulishing more free apps for you to enjoy. So use your best judgement here and use these tweaks with discernment...​

Message to moderators

: if this goes against xda policy in any way, please let me know and I'll remove all this from here.

OK, now that this is set clear, here's what that is all about:

I'm sure that most of you guys have seen ads (or upgrade) banners in free apps and being an xda member, you probably know a few tricks to get rid of some of them. I mean ads like the ones apps or games that do not really need internet connections can easilly be blocked by using ip-tables rules/firewall/anti-ads apks to completly block their internet (like with Droidwall for example). But what about ads on the apps that DO need internet connection and than cannot be completely blocked? What about the empty screen space left for banners on some others with blocked internet access?

Well, through my readings, I've found that some suggest to hack the apks and to simply decompile them, go in \decompiled_apk\smali\com\google\ folder and delete the "ads" folder altogether. Well, from my experience, this doesn't work very well. In many cases, the modded app will not install and in some other cases, the trick might work for a while and then the ads would eventually come back. That last case just happened to me: a while ago, I've tweaked the DI Radio app like so and things seemed just fine. And today, bam!!: ads banners again. God knows how/why they came back with that "ads" folder deleted, but they did!!

So with a little thinkering and code browsing, I've figured out a very simple way to get this done - here's how:

What you need:

- An apk decompiling/compiling/signing tool(s) of your choice;

- the excellent text editor notepad++ - get it from here

Notes:

- PLEASE, do not fill this thread with questions like: how do I decompile/sign apks? - it's not the place here - thanks!

- And please do not full-quote this long post either ;)

- If you rewrite/repost this somewhere else, please play it fair and give credits/link to this thread.

HOWTO:

1. Pull and decompile your apk;

2. Go in \res\layout folder and select all the xmls files, right-click of the highlighted file and press "open" and they should all open with Notepad++ [just click OK if you get the "confirm 'Open' Action"];

3. Select Search/Find... and enter: "@id/ad" [no quotes ""] and press "Find ALL in All opened Documents" on the search popup dialog box;

4. Now look at the search results and there might be 2 possible (maybe more.. I've tried this on only 2 apks so far...) result types:

--> As a first illustration of this: for the DI radio apk I've mentioned above [I use an older version and not the latest that requires login every time...], you get an xml called "playing.xml" with this at line 6:

<FrameLayout android:layout_gravity="center" android:id="[COLOR="Red"]@id/ad[/COLOR]_frame" android:layout_width="[COLOR="Red"]320.0dip[/COLOR]" android:layout_height="[COLOR="red"]50.0dip[/COLOR]">

On that line, we can see some size attributes for that banner; just resize them to 0!!;

So all there is to do is to edit it like so:

<FrameLayout android:layout_gravity="center" android:id="@id/ad_frame" android:layout_width="[COLOR="red"]0.0dip[/COLOR]" android:layout_height="[COLOR="red"]0.0dip[/COLOR]">

-->> Second case: for some other apks (like for an older version of a very famous file explorer..), you might get multiple results (many xmls - 6 or 7 of them) all looking like this:

<com.google.ads.GoogleAdView android:layout_gravity="center" android:id="[COLOR="red"]@id/ad[/COLOR]view" android:layout_width="wrap_content" android:layout_height="wrap_content" />

So no banner sizes in this case but all there is to do is to delete all those lines completely and then save all the respective xmls. Then,

5. Recompile and sign the apk;

6. Backup [for restoring its data later..] and then uninstall your original apk from your phone (if still there)

7. Install your modded one and enjoy your app without any ads, blank spot or nag screen. :p

Final notes:

- Now, this doesn't stop the app to get the ads from the internet, but it does give you a simple way to hide them and this also make accidental clicks on them a story of the past... :D

- This is pure dirty hacking and not a general procedure; there might be different ways to implement ads in apps and ways to hide them; so please try at your own risk and feel free to share your results/tricks with us.

- Thanks to oSandmaNo for reminding me this

one important drawback

: when you tweak apps like so, you will get an error message when trying to update them on the Playstore. You will have to uninstall them before being able to update. so this mean that make a backup with Titanium Backup (or others) first in order to later restore the app's DATA ONLY. Obviously, the remove ads tweak will then be gone after the update, but since you've done it once, it should be fairly easy to do it once more..

- Read post #3 for a few additional tips.

.

.