[MOD] Enable / Disable AdBlock in your rooted ROM - Desire Android Development

This MOD is two files:
Enable Adblock Update File
Disable Adblock Update File
Download this two files to your SD card, apply (flash from recovery) first file if you need AdBlock, apply second if you don't need AdBlock. This files works at all rooted Android ROM's and phones, not only for Desire.
Source for AdBlock hosts file:
http://www.mvps.org/winhelp2002/hosts.txt
http://pgl.yoyo.org/adservers/serverlist.php?showintro=0;hostformat=hosts
See also my B&W Theme for Desire :-D.

Thank you

Thanks, works like a charm!

this block adds in apps?

Works very good! Thank you!

pinkolin said:
This MOD is two files:
Enable Adblock Update File
Disable Adblock Update File
Download this two files to your SD card, apply (flash from recovery) first file if you need AdBlock, apply second if you don't need AdBlock. This files works at all rooted Android ROM's and phones, not only for Desire.
Source for AdBlock hosts file:
http://www.mvps.org/winhelp2002/hosts.txt
http://pgl.yoyo.org/adservers/serverlist.php?showintro=0;hostformat=hosts
See also my B&W Theme for Desire :-D.
Click to expand...
Click to collapse
where do we put hosts.txt file?

pinkolin, there are extra lines at the end of the hosts file:
Code:
</pre>
</body>
</html>
I suppose they should not be there, even if they do not cause issues.

kmetek said:
where do we put hosts.txt file?
Click to expand...
Click to collapse
It's in /system/etc but if you flash the ZIP file above, it will put the file at the right place by itself.

Thank you

what is the difference between adblock and ad free? does one block website adverts and the other block adverts in apps, or do they do the same thing?

Another way to do it...
And with this solution you can use AdFree with no freeze :
With ROM Manager, reboot in clockworkmod recovery...
From your computer with adb in DOS mode (adb-windows.exe for me) do this :
> adb-windows.exe shell
you should have now a # prompt
# mount /system
# mount /data
# cd /system/etc/
# mv hosts /data/data/
# ln -s /data/data/hosts hosts
# cd /
# umount /data
# umount /system
Now you can reboot your system from Clockworkmod recovery menu
Install ADFree from the market, and it should work.
It worked well for me.
Use it at your own risk.
Just to explain what it does :
When phone is working the partition /system is in read only. ADFree tries to write in it, it crash.
The solution I give is the same as for bootanimation.zip
Move the file "hosts" from read-only file-system (/system) to a writable file-system (/data) and make a symbolic link to it in /system to fake it position.
Phone believes "hosts" is still in /system. and ADFree can write in it because it is in /data for real....

Thank you so much Orphee. This eventually fixed it for me after struggling for a couple of hours without success. Couldn't write hosts to system/etc/ while system running; couldn't get Droid explorer to mount files (device in recovery mode). Tried with Root Explorer and couldn't copy hosts to /system/etc/ due to 'file too large/not enough room' error. Tried with adb and again couldn't successfully copy hosts file. All very frustrating, and I wish I understood the problem better.
Anyway, your symbolic link solution finally cracked it, though I had to try twice. FIrst time Adfree stalled. Second time I ran 'Revert' first and it then it worked fine.

Hi there. I can't get this to flash. I get:
Code:
E:Failure at line 3:
copy_dir PACKAGE:system SYSTEM:
Installation aborted.
What now?

Orphee said:
Another way to do it......
Click to expand...
Click to collapse
Best explanation and instructions I've seen on this - thanks a lot!

hey guys,
I don;'t know if you already knew this but,
if i've installed adfree on my phone the application
pingchat! wont work anymore it cant get connected to the server
to send the messages :s and when i delete adfree it works normally...

I used the 'enable' zip, but my hosts file still cannot be changed. Using CM 6.0.2

Can this be applied from ClockworkMod recovery mode to a stock Froyo sense rooted phone that is odexed and s-on?
Also not answered is does it block website ads when in browser or/& ads that appear when running apps.
Anyone???
Edit: Worked like a charm! No more damm ads.

Thanks
Worked like a charm!!
carlos67 said:
Can this be applied from ClockworkMod recovery mode to a stock Froyo sense rooted phone that is odexed and s-on?
Also not answered is does it block website ads when in browser or/& ads that appear when running apps.
Anyone???
Click to expand...
Click to collapse
Yes it blocks the ads from apps & browser

Woah! Great! so, no ads when im playng Angry Birds!

Pure Calendar Widget (Agenda)
I use the "Pure Calendar Widget (Agenda)" from the market, after flashing the MOD and rebooting the widget fails to load my calendar. Have flashed the disable MOD and it's back to working as normal. Weird as its a paid app and there is no advertising in it.

Related

Fixing the user agent problem with the H builds

I wonder why nobody has noticed this but the default user-agent is actually stored in a simple XML file under /data/data/com.android.browser/shared_prefs/
So if you unzip the attached file and push it to your phone, you will be using the new ua next time you start the browser
Code:
adb push com.android.browser_preferences.xml /data/data/com.android.browser/shared_prefs/com.android.browser_preferences.xml
This is tested to survive a reboot.
billc.cn said:
I wonder why nobody has noticed this but the default user-agent is actually stored in a simple XML file under /data/data/com.android.browser/shared_prefs/
So if you unzip the attached file and push it to your phone, you will be using the new ua next time you start the browser
Code:
adb push com.android.browser_preferences.xml /data/data/com.android.browser/shared_prefs/com.android.browser_preferences.xml
This is tested to survive a reboot.
Click to expand...
Click to collapse
Nice Job. Worked great.
Sorry
I'm a little new on this is there any way to do this on Os X ?
Thanks!
If you're semi-lazy and don't do adb (I've never really tried to get it working under Linux) you can do those copies under the root terminal emulator. It's the same process (cp) as copying the mountd and init files when you originally rooted the phone. The only difference is, /data is mounted read/write to begin with so you don't have to re-mount it.
you can extract the zip to the root of your sdcard and type the following in terminal
Code:
su
cp /sdcard/com.android.browser_preferences.xml /data/data/com.android.browser/shared_prefs/
Hi,
This is a working broswer for the H builds.
Bookmarks saved and deleted.
Sites display correctly.
Zoom function works.
Rename Browser.zip to Browser.apk and push to phone.

File explorer via DDMS doesn't work

When I try and use the file explorer in DDMS for my device it just comes up as blank. I am am running JF ADP1.5 on the device and the 1.5SDK on Mac OS X.
Can someone please confirm that DDMS file explorer works for JF ADP1.5 (preferably on Mac).
Anyone have any other suggestions?
it never worked on 1.5 for me...
This is because you are using a modified firmware.
You have to replace the busybox ls file with the toolbox ls file.
but my ls is linked to toolbox ?
just had another go, it appears you have to close the file explorer and open it again
Ah ok thanks. I didn't know that. What is the easiest way for me to get a file out of an application directory then. I want to get the sqlite database from an app I am writing off the phone.
I'm using apps2sd so I thought the application data should reside in /system/sd/app but if I navigate there in linda or astro it is blank. /data/app is also blank.
BGH80 said:
I'm using apps2sd so I thought the application data should reside in /system/sd/app but if I navigate there in linda or astro it is blank. /data/app is also blank.
Click to expand...
Click to collapse
/data/data
jashsu said:
/data/data
Click to expand...
Click to collapse
/data is also empty
Have you tried opening it with Term Emu or adb instead of a file manager?
Well I'm a bit stuck now.
I got thinking my apps 2 sd wasn't working so I just decided to switch to the unionfs method.
Now my phone is looping. I don't want to do a wipe and I don't have access to ADB here at work so I can't copy a new update.zip ROM to my phone.
So I can't check anything until I get home and can reflash my phone which will hopefully fix the problem.
Ah what a nightmare. The unionfs apps2sd didn't work on the first attempt so I ended up having to reformat, wipe, reinstall etc. I'm back up and running now and was able to get the file I wanted via adb pull.
How come file managers don't show the contents of folders such as /data/data/ ?
BGH80 said:
Ah what a nightmare.
Click to expand...
Click to collapse
Welcome to A2SD.

How do i add apk to custom rom?

Hi,
I have a few apps and would like to add into custom rom. I read and google but no help.
Using winrar and open custom rom, i create a folder /data/app and place all apk in "app" folder. non of the apps in that folder installed. Do i need to do more then just add the apk?
I read here http://forum.xda-developers.com/showthread.php?t=1198035 and no use. maybe OP not don't with the guide yet.
thx
cat2115 said:
Hi,
I have a few apps and would like to add into custom rom. I read and google but no help.
Using winrar and open custom rom, i create a folder /data/app and place all apk in "app" folder. non of the apps in that folder installed. Do i need to do more then just add the apk?
I read here http://forum.xda-developers.com/showthread.php?t=1198035 and no use. maybe OP not don't with the guide yet.
thx
Click to expand...
Click to collapse
Reread that thread. The answer is in there.
Hint: ROM flash packages never put anything in /data
you can preinstall apps to /data/app but it takes update script modding. if you havent figured it out it is a lot easier to add them as system apps in /system/app
@Dani897: I try adding apk to /system/app or /data/app but none are working. When I add apk to /system/app; after the rom flashed and reboot, Samsung kept on flashing forever.
cat2115 said:
@Dani897: I try adding apk to /system/app or /data/app but none are working. When I add apk to /system/app; after the rom flashed and reboot, Samsung kept on flashing forever.
Click to expand...
Click to collapse
check your permissions!
the data/app way need adition work in the update script. im not gonna get into that.
Dani897 said:
check your permissions!
the data/app way need adition work in the update script. im not gonna get into that.
Click to expand...
Click to collapse
Thanks. How do i check permission? in CWM? In cwm (red) v2.5.1.3 -->Install zip from sdcard --> toggle signature verification-->disable'
In advance, all i see is fix permissions.
cat2115 said:
Thanks. How do i check permission? in CWM? In cwm (red) v2.5.1.3 -->Install zip from sdcard --> toggle signature verification-->disable'
In advance, all i see is fix permissions.
Click to expand...
Click to collapse
no in a terminal emulator or in linux. they get screwy sometimes if you do editing in windows. i cant even seem to get ownership of one of my flash drives on my linux machine after i formatted it with windows.
if you are on a mac you can do it by clicking and choosing "get info" from the context menu apparently but i dont own a mac so i dont know.
i never used it but check out cygwin and do some googling on permissions in terminal/console. it might be best if you are not ready to install a new os. but you can also install ubuntu with the wubi installer inside windows of use a vm with osx or the linux distro of your choice pretty easily. please dont ask for support questions on doing those things.
you can find permissions of files in a directory with ls -l
you can change them with chmod an ususally one of the numbers below but there are others, google is your friend
666 is rw-rw-rw
644 is rw-r--r-
777 is rwxrwxrwx
755 is rwxr-xr-x
644 or 755 are the most likely that they should be.

[DEAD][Script][4.4.2] How to make all apps read External SD Card

This fix Requires ROOT and Busybox installed to /system/xbin
Context: I have been looking for a way to make an app that hides files to read/write files on my external SDcard, The way I found was to edit the platform.xml file to add that missing line as guided here: LINK this is just one of the many articles saying the same thing. which helped some apps work, but not the one i was looking for.
Reason: the point of this script is to make it so you do not have to set permission to the "media_rw" folder after every reboot manually.
Steps:
1) Follow and complete guide linked above, or any other similar guide, if you have not done so already.
*NOTE* some custom ROMs have already implemented this fix
2) After reboot use an app that allows you to make scripts (Ex. Rom Toolbox) this guide will use Rom Toolbox app
- create new script, name it whatever you want. I named it "sdcard permission"
- input this line and save:
Code:
chmod 777 /mnt/media_rw
*NOTE* you do not need to put it as 777 but it is what worked for me as it gave full read/write/execute permissions
3) Set script to run at boot
4) Run script manually then check app to see if it worked
-Alternatively go check /mnt/media_rw to see if it has the new permissions
Now you should be able to access the external SD card after every boot.
NOTE: you may need to redo the guide in the first step after switching ROMs as the new ROM may not have the fix implemented.
Reserved just in case
Buddyjohn said:
This fix Requires ROOT and Busybox installed to /system/xbin
Context: I have been looking for a way to make an app that hides files to read/write files on my external SDcard, The way I found was to edit the platform.xml file to add that missing line as guided here: LINK this is just one of the many articles saying the same thing. which helped some apps work, but not the one i was looking for.
Reason: the point of this script is to make it so you do not have to set permission to the "media_rw" folder after every reboot manually.
Steps:
1) Follow and complete guide linked above, or any other similar guide, if you have not done so already.
*NOTE* some custom ROMs have already implemented this fix
2) After reboot use an app that allows you to make scripts (Ex. Rom Toolbox) this guide will use Rom Toolbox app
- create new script, name it whatever you want. I named it "sdcard permission"
- input this line and save:
Code:
chmod 777 /mnt/media_rw
*NOTE* you do not need to put it as 777 but it is what worked for me as it gave full read/write/execute permissions
3) Set script to run at boot
4) Run script manually then check app to see if it worked
-Alternatively go check /mnt/media_rw to see if it has the new permissions
Now you should be able to access the external SD card after every boot.
NOTE: you may need to redo the guide in the first step after switching ROMs as the new ROM may not have the fix implemented.
Click to expand...
Click to collapse
I have a Samsung Galaxy S3 and been trying all kind of things to get to media_rw folder to keep its read writable and nothing worked so far. I did everything in you post to see if it would help/work but script not working. I can only keep permissions if I set manually set permission using root browser and then it working until I reboot the phone and I tried adding the script using ROM Toolbox pro but its not even changing the media_rw permission when run it.
This my first time using the script tool but to me seems to be setup properly. If needed I will get some screenshots of the script windows to show how I set it up. I am just posting this now to see if anyone can help or wants to ask some questions.
I know how permissions work in Windows and getting up to speed with Android. I been trying to make the media_rw folder r/w to be able to able to path it to my Titanium Backup folder on my external SD.
This looks similar to setting boot bat files in Windows so I know it should work but no go so far.
Heres the screenshots of my script that failed to run and the output file hoping to get some advice why script did not work.
Is this thread dead? Should I seek answers elsewhere?
techmanc said:
Is this thread dead? Should I seek answers elsewhere?
Click to expand...
Click to collapse
yes this thread is dead, lots of apps are updating compatibility finally, also there are some xposed modules that essentially does what i did on here. so this is dead.
Buddyjohn said:
yes this thread is dead, lots of apps are updating compatibility finally, also there are some xposed modules that essentially does what i did on here. so this is dead.
Click to expand...
Click to collapse
can yuo point me to some threads that are still working cause I still not been able to get RW access to media_rw folder.
techmanc said:
can yuo point me to some threads that are still working cause I still not been able to get RW access to media_rw folder.
Click to expand...
Click to collapse
try these three xposed modules, i recommend enabling one at a time to see which works, reboot after enabling one.
http://forum.xda-developers.com/xposed/modules/app-handleexternalstorage-t2693521
http://forum.xda-developers.com/xposed/modules/kitkat-sd-card-access-t2790992
http://forum.xda-developers.com/xposed/modules/xposed-disablesignaturecheck-t2789267
also i just realized why it was failing on yours. make sure you have busybox installed to system/xbin
that will make the script work. or atleast should.
Buddyjohn said:
also i just realized why it was failing on yours. make sure you have busybox installed to system/xbin
that will make the script work. or atleast should.
Click to expand...
Click to collapse
Looked s Busybox says installed to /system/bin heres the screenshot do I click install to move or use smart install. Never did much with app just know it was needed for rooting.
techmanc said:
Looked s Busybox says installed to /system/bin heres the screenshot do I click install to move or use smart install. Never did much with app just know it was needed for rooting.
Click to expand...
Click to collapse
Install it to /xbin
Buddyjohn said:
Install it to /xbin
Click to expand...
Click to collapse
What the difference between installing to /xbin vs /system/bin might I ask?
techmanc said:
What the difference between installing to /xbin vs /system/bin might I ask?
Click to expand...
Click to collapse
Honestly I am not to sure, I just assumed xbin was the right one as a lot of older mods and roms required busybox on xbin. so i tried it and it worked.

I Can't Get Root Back

I have a Motorola Edge (regular not +) running LineageOS 17.1 (20210528). I had it rooted and decided I wanted to use the hosts file for ad blocking. I couldn't figure out how to get the OS to allow me to modify the host file. While I was doing so, I some how corrupted to OS and couldn't boot into it. That was easily fixed by flashing the the OS, but now I can't get root back. When I reboot after I flash the patched boot.img (to both partitions), I get "Can't load Android system. Your data maybe corrupt..." (This happens when I try to boot into both partitions). Before I see the error message, it goes into a bootloop.
I'd also like to know how to modify the hosts file.
Thanks
Heat84 said:
I'd also like to know how to modify the hosts file.
Click to expand...
Click to collapse
Once phone is rooted
1. You mount Android's directory /system/etc as RW
2. Pull out the hosts file what is located therein to PC
3. Edit the hosts file according to your needs
4. Make sure hosts file gets saved in UNIX-file format
5. Push back the hosts file to Android's /system/etc directory
6. Make hosts file RW
Thanks. Any clue about the rooting problem?
I forgot to mention that I patched boot.img with Magisk.
TWRP has a file system repair function. Does that have anything to do with this?

Categories

Resources