Fix for GB getting mobile version of website despte desktop UA string - Android Software/Hacking General [Developers Only]

I've noticed since upgrading my Droid X to Gingerbread that many websites that were previously fooled by setting the User Agent (in Dolphin HD) to "desktop" are no longer fooled and can now detect that I'm on a mobile device. This can be quite irritating as the mobile version of many sites is horrible.
To see if this article pertains to you, if you're set for a desktop user agent string, go to http://www.bbc.co.uk and see if you get the mobile version of the page or the desktop version. If you get the mobile version despite your user agent setting, this hack may help you.
When this first happened to me I decided to find out how the sites were detecting the fact that I'm on a mobile device. Generally a website only knows what you tell it about yourself, and what you tell it about yourself is 100% in the HTTP headers your browser sends (or that get added by a proxy server if you use one). So the first logical place to look was to see what all headers the browser was sending. Note: for any who might object that it also knows things about you by your cookies, your cookies are actually sent as HTTP headers as well.
I have a CGI script on one of my web servers that I use to see what all headers my browser is passing. There are plenty such scripts/sites on the web -- here is a decent one (it's not mine) if you want to see what your browser sends. Examining the headers, one stuck out like a sore thumb:
Code:
HTTP_X_WAP_PROFILE='http://uaprof.vtext/com/mot/mb810/mb810.xml'
Geez, that's a pretty dead giveaway isn't it? I checked a phone running FroYo and it does not send that header, so that further confirms this is the header these sites use to detect me as a mobile (since they don't detect me as a mobile under FroYo and do under Gingerbread).
I then Googled HTTP_X_WAP_PROFILE and found numerous coding resources where they suggest looking to see if that header exists and/or is set to anything in order to detect mobile browsers. Bingo.
Great - so how to get rid of it? My first thought is that since the header is clearly identifying me as a Droid X (MB810), there has to be something in the phone that is providing the data. Since I observed that the header is present whether I access the net via WiFi or via 3G, that further confirmed that this is all happening in the phone and not being added by Verizon in transit.
The first sensible place to look was /system/build.prop. Turns out that the first sensible place to look was the right place to look as I found this line:
Code:
ro.mot.hw.uaprof='http://uaprof.vtext/com/mot/mb810/mb810.xml'
Well, that's about as perfect as you could ask for. Not knowing if the phone might be touchy about completely removing this setting, my first attempt was to change the line to read like this:
Code:
ro.mot.hw.uaprof=''
I found that you must reboot the phone for the setting to take effect (no real surprise there). Unfortunately, afterward, when I examined the headers being sent by the browser, they now contained this:
Code:
HTTP_X_WAP_PROFILE=''
With that setting, the various websites still detected me as a mobile browser (which you would expect). Next I tried changing the build.prop to this:
Code:
ro.mot.hw.uaprof=
* Note - there is nothing after the equal sign - not a space or anything, just a carrriage return.
This (pleasantly) resulted in the HTTP_X_WAP_PROFILE header being completely absent -- the ideal outcome. Happily, the various websites that were detecting me as a mobile no longer did. Success!
In the interest of being thorough, I tested just removing the ro.mot.hw.uaprof setting altogether (by commenting out the line). I figured that probably was not the best plan, but I wanted to see what would happen. When I did that, the following header was the result:
Code:
ro.mot.hw.uaprof='http://uaprof.motorola.com/phoneconfig/MotoMB200/profile/MotoMB200.rdf'
Interesting default value -- and of course I was again identifiable as a mobile device.
So, the fix for this is pretty simple. The exact property that needs to be modified in your build.prop would of course vary if you're not running a Motorola build, but I'd expect it to be readily identifiable. Of course you have to be rooted to do this, and of course you should make a backup copy of your build.prop before you modify it, and of course you should think about what your fallback recovery is going to be if you foul up your build.prop and end up in a boot loop or something. Can you boot into Recovery and then fix the file with ADB, etc. -- it all depends on how your phone is set up.
For those that like step-by-step, here's precisely what I did:
Open Root Explorer (or other "root aware" editor)
Navigate to /system
Mount system as R/W
Open build.prop in text editor
Find the ro.mot.hw.uaprof line
Put a # at the beginning of the existing line (to make it into a comment)
Insert a new line below the existing line that says "ro.mot.hw.uaprof=" (without the double quotes -- no characters after the equal sign)
Save and exit editor
Mount system as R/O
Reboot phone
By doing it this way I end up with a backup copy of the original string in case I want to easily put it back. Root explorer automatically saves the original build.prop as build.prop.bak, but if you're really cautious you might want to actually make a copy of the file to your SD card or something.
At this point, in Dolphin HD, with my user agent string set to Desktop, all of the web sites that had begun seeing me as a mobile device now serve the normal desktop page (as desired). If I want to see the mobile version (for some reason) I can just switch Dolphin HD back to Android mode (user agent string) and then I get the mobile version.
Hope this helps someone. Sorry it was so long -- almost everything I write up is.
P.S. If you do this successfully on a non-Motorola phone, post here and let others know.

firstly,, BIG THANKS
I am running a GB2.3.3build.596 P3D 2file root DroidX..
when i open ROOT EXPLORER in r/w mount and open the build.prop i can not type anything..and this mobile site only crap was the reason i took 2 days of forum reading at 3 forums before i went ahead and sbf'd back to froyo from a stock Verz 2.3.3GB to then root ,and then to install the 2 P3D files to have a .596 build GB rooted phone
any suggestions, maybe another editor ware? total newb

Related

Market Fix - Froyo Apps + Tegra 2 Apps

In addition to the standard Market Fix to get protected applications working (clearing cache/data), we also need to trick Google to think we have a Tegra 2 device.
We simply need to change the following line in /system/build.prop
ro.product.device=olympus
This tells Google Market we are using a Motorola Atrix 4G and will give us the missing Tegra 2 apps when applying our market fix.
However, since we are mimicking a phone, Tablet specific apps will not show up (NYTimes app for Tablets is an example)
Cheers!
Edit:
It is well known that the Google Web Market is hit and miss on our GTablets. This thread indicates it may take a few days for our tablet's to show up on the web interface. However, what this fix does is allow you to download most of the Froyo + Tegra2 apps via the Market Application within our tablets. There will be applications that will refuse to install through the web market interface (if your tablet can actually show up on the darn thing) because of missing capabilities, but will install just fine via the Market app.
If you want to install apps using a web browser from your Desktop computer, I recommend the use of Appbrain to generate your list of desired apps and then syncing your list on the tablet to install.
Hi,
SUPER!!
This build.prop change, just by itself, on stock 3588, allows me to see a bunch of apps I haven't been able to see before, including Firefox, Flash, Tank Hero, etc. Didn't have to do anything else, no fingerprint changes, etc.
Thanks!
Jim
AWESOME! The only thing I can't find is message ease which is no great loss and I'm not seeing it on the web either -- I think they are pulling it on and off the market. But YES -- Laucher Pro, Saumari, Silver Creek games, Flash 10.2, tv.com, both opera browsers, dolphin HD -- all there. FANTASTIC. THANK YOU!
Even Vlingo shows up which was never found before. Truth is I don't even want it but it was one of my indicators.
wd5gnr said:
AWESOME! The only thing I can't find is message ease which is no great loss and I'm not seeing it on the web either -- I think they are pulling it on and off the market.
Click to expand...
Click to collapse
Are you looking for MessagEase?
https://market.android.com/details?id=com.exideas.mekb
Whoops! Helps if you spell it right. I always think that should be a faster keyboard but then I give up and go back to BetterKeyboard or the word predicting one which is great until you need to do Linux command lines and such.
Sorry for the confusion. I even found Astro Bluetooth Module another I used to have to switch for. Very cool.
Hmmm... the market.android.com site no longer shows my device since I made the above fix! It only shows my older device. I tried just clearing the market cache and rerunning but no go. I am now running the regular market fix (clear cache in market, stop, clear data in service framework, stop, reboot).
I did install things off the market, but it had to be from the device.
Ok tablet is booted back up.... drum roll....
Nope. And now I am -- for now -- only showing my paid apps off the market, none of the freebies I had previously installed.
UPDATE: I killed the market data and cache along with the service framework data and rebooted. This made no difference to the web site (unless it takes time for it to catch up) but it did -- after installing something else -- restore my existing apps. On the other hand, having the market working on the device beats the web site, but it still means something is "off".
How do we request this be made a sticky?
I know I've tried just about every market tweak for the last 3+ months and this is the only 1 that made a huge diff.
Jim
I haven't tried this fix (heck I don't even know how to apply it, someone mind helping a noob out?) but I had the same problem you did where the web market doesn't show your device. I tried spamming the regular market fix and still no good.
However I logged back into the web store today and it showed my device, weird.
Not sure how to fix it but yesterday I changed my password so I was forced to sign in again. Of course that didn't work at the moment but I guess it worked since I can now see my device now.
Hope this helped.
wd5gnr said:
Hmmm... the market.android.com site no longer shows my device since I made the above fix! It only shows my older device. I tried just clearing the market cache and rerunning but no go. I am now running the regular market fix (clear cache in market, stop, clear data in service framework, stop, reboot).
I did install things off the market, but it had to be from the device.
Ok tablet is booted back up.... drum roll....
Nope. And now I am -- for now -- only showing my paid apps off the market, none of the freebies I had previously installed.
UPDATE: I killed the market data and cache along with the service framework data and rebooted. This made no difference to the web site (unless it takes time for it to catch up) but it did -- after installing something else -- restore my existing apps. On the other hand, having the market working on the device beats the web site, but it still means something is "off".
Click to expand...
Click to collapse
Yeah I tried logging out of the web site and back in. I've tried forcing a google account sync. And I've tried making sure Talk is running (apparently the website uses talk to send things to your device.).
Just for fun I put my ro.product.name/device/board back to Vega and with no reboot or anything the web site immediately found the device.... curious....
Well now that I'm back on the web site, my market is back to how it was even after I put the olympus line in. Getting too late. Will look at it tomorrow :-(
Hachi2Go said:
I haven't tried this fix (heck I don't even know how to apply it, someone mind helping a noob out?) but I had the same problem you did where the web market doesn't show your device. I tried spamming the regular market fix and still no good.
However I logged back into the web store today and it showed my device, weird.
Not sure how to fix it but yesterday I changed my password so I was forced to sign in again. Of course that didn't work at the moment but I guess it worked since I can now see my device now.
Hope this helped.
Click to expand...
Click to collapse
I did the change by:
- get temp root via z4root
- make /system R/W via root explorer
- start a terminal
- cd /system
- Edit build.prop: busybox vi build.prop
- did regular market fix
- reboot
Jim
wd5gnr said:
Hmmm... the market.android.com site no longer shows my device since I made the above fix! It only shows my older device. I tried just clearing the market cache and rerunning but no go. I am now running the regular market fix (clear cache in market, stop, clear data in service framework, stop, reboot).
I did install things off the market, but it had to be from the device.
Ok tablet is booted back up.... drum roll....
Nope. And now I am -- for now -- only showing my paid apps off the market, none of the freebies I had previously installed.
UPDATE: I killed the market data and cache along with the service framework data and rebooted. This made no difference to the web site (unless it takes time for it to catch up) but it did -- after installing something else -- restore my existing apps. On the other hand, having the market working on the device beats the web site, but it still means something is "off".
Click to expand...
Click to collapse
You're right that having market work on the device beats the website! The web market issues may be a whole separate battle.
Jim
jimcpl said:
I did the change by:
- get temp root via z4root
- make /system R/W via root explorer
- start a terminal
- cd /system
- Edit build.prop: busybox vi build.prop
- did regular market fix
- reboot
Jim
Click to expand...
Click to collapse
I'm quite new to the Android OS so I'm not really sure how to do this.
I installed z4root and got temp root. I'm not sure if I needed it as I read somewhere that Vegan 5.1.1 (which I am using) gives me root already.
But I installed it and ran it anyways.
I'm stuck on giving my /system read and write permissions. Is this 'root explorer' app needed? Or can I use my 'iFileExplorer' app to do so, if so how? (It came with the vegan ROM)
Not sure if you meant to type ifileManger, but it will not get you write permissions. Root explorer will allow you to write. It looks as though you may have to
open a terminal up as discussed above, to change the build prop.
Hachi2Go said:
I'm quite new to the Android OS so I'm not really sure how to do this.
I installed z4root and got temp root. I'm not sure if I needed it as I read somewhere that Vegan 5.1.1 (which I am using) gives me root already.
But I installed it and ran it anyways.
I'm stuck on giving my /system read and write permissions. Is this 'root explorer' app needed? Or can I use my 'iFileExplorer' app to do so, if so how? (It came with the vegan ROM)
Click to expand...
Click to collapse
Hachi2Go said:
I'm quite new to the Android OS so I'm not really sure how to do this.
I installed z4root and got temp root. I'm not sure if I needed it as I read somewhere that Vegan 5.1.1 (which I am using) gives me root already.
But I installed it and ran it anyways.
I'm stuck on giving my /system read and write permissions. Is this 'root explorer' app needed? Or can I use my 'iFileExplorer' app to do so, if so how? (It came with the vegan ROM)
Click to expand...
Click to collapse
Hi,
If you don't have root explorer, there's a free app on market called something like "system mount r/w" that is free that will mount /system as r/w for you. Or, I think that you can do it using a terminal and a mount command (something like mount -remount....).
Normal file explorers won't do the remount.
Jim
mount -o remount,rw /system /system
Watch out for the spaces and you need to be root so do an su command first.
When done, repear the mount command but use ro instead of rw. You can do this with a terminal program or the adb.
Root Explorer is what, $3.99? Worth it for the time savings. I bought the Ti Pro too. $300+ on a tablet...spend $9 on some software to make life easier.
iam a noob. i have stock rom 3588. how do i get market working?
By the light of morning I got back to a full market! But it again broke the web site connection. Is anyone seeing this behavior? Or is it just me?
For the new guys.
1) This appears like it MAY break your connection with the market web site [Update: Wait a few hours and it appears to catch up with you]. It may have other unknown effects. If you are not comfortable with making mods you might wait until more people have reported success or failure with this. For the record I did NOT find this fix (thanks Isira -- see OP of this thread). Just writing up my take on what you need to do. This applies to VEGAn 5.1.1 with supplement. It has been noted that with a stock rom you may need to put "busybox" before commands like cp (which you don't need to use if you have Root Explorer, by the way). If you get this to work (or not) on a different ROM, report it in this thread.
2) That being said, you need a file explorer that will look at / and edit text files, an su utility (comes with your root kit; as far as I know all the custom ROMs are pre rooted) and a command shell/terminal. Or you could spring a few bucks and get Root Explorer which is well worth it and does all of these things. Others have suggested Absolute Root tools which I do not know about. You could also use adb for all of it (which is what I did) but if you know how to do that, you probably don't need me to tell you what to do. We will be changing your build.prop file in the /system directory.
IF YOU ARE NOT USING ROOT EXPLORER GO DOWN TO STEP 3B. IF YOU ARE, GO TO STEP 3A.
3A) Open root explorer. Find /system and press the "Mount R/W" button.
4A) Long press on build.prop and select Copy. Then navigate somewhere like /mnt/sdcard and press the paste button at the bottom of the screen. This is your backup. Please backup.
5A) Go back to /system
6A) Long press on build.prop again. The menu is scrollable. You want Open in Text Editor.
7A) Find the line that says ro.product.device=XXXX (where XXXX is probably Vega). Make it read:
ro.product.device=olympus
Don't change anything else.
8A) Save the file by pressing the menu key and selecting Save & Exit.
9A) Scroll to the top of the /system directory and press the Mount R/O button.
10A) Reboot your tablet. Wait for things to settle down on restart. Open Market. Look for Saumari 2. Look for LauncherPro, Opera Mobile, etc. It will all be there.
If you don't have root explorer:
3B) Open the terminal. At the prompt, enter (spaces and lower case matter):
su
mount -o remount,rw /system /system
HINT: If you think you will do this a lot grab Script Manager off of the market. You can put the mount line in a script, tell it to execute as root (which is the same as su) and then you can run the script when you want to make changes.
4B) Start your file manager and find the /system directory. Your file manager probably starts in /sdcard or /mnt/sdcard. You'll need to go "up" a directory or two to root and then back down. Either way, when you find it, make a backup copy of build.prop somewhere you can write to. Seriously. Do not skip this step. Make the copy.
5B) Edit build.prop. You are looking for a line that sys ro.product.device=XXXX (probably Vega; I don't know about other ROMs and if this works for other ROMs but for VEGAn 5.1.1 its Vega). Carefully replace whatever you have as XXXX to olympus. So the line should read:
ro.product.device=olympus
Note: Some of us had other changes to build.prop. Not clear if these had any effect or not.
6B) Save your changes. If your file explorer is not root, you probably need to save the file to where you can write (your sdcard for example) and the copy from a terminal, such as:
su
cp /mnt/sdcard/new-buildprop.txt /system/build.prop
or
su
busybox cp /mnt/sdcard/new-buildprop.txt /system/build.prop
7B) Open your terminal and enter:
su
mount -o remount,ro /system /system
Remember spaces and case count! Also if you are in the same terminal window as before you don't have to keep entering su since you stay root.
NOTES FOR BOTH SETS OF INSTRUCTIONS
I did the original market fix after saving the file, but some people say it is not necessary. But at least a few people have said they don't see much or anything in market until the redo the fix (the one where you delete the market cache and the google services framework data and reboot).
Things that appear to work:
1) Installing free programs
2) Updating existing programs
3) Amazon market web site oddly enough
4) The official market Web site AFTER WAITING SEVERAL HOURS
5) Buying an app off the build in application
Some of us had other changes to build.prop but I don't think any of them were significant. If you have trouble you might apply it (shouldn't hurt). Also, if your "my apps" only shows your paid apps (or nothing if you have no paid apps), try downloading anything off the market and that will usually restore it. There is also an update local cache key that might do the trick, but loading some freebie off the market is easier. Also check to make sure gtalk is logged in. You can try forcing a resync on your Google accounts (in the main menu under Accounts).
Hope that helps someone. Its early so I probably made mistakes and will edit any that are found.
wd5gnr,
I don't know how "unusual" it is, but on my Gtab, where I had 3452 for awhile, then now 3588, I've always noted that I don't have a "cp" command, so I have to use "busybox cp".
Just FYI, in case anyone encounters this when they try your instructions.
Jim
wd5gnr said:
By the light of morning I got back to a full market! But it again broke the web site connection. Is anyone seeing this behavior? Or is it just me?
Click to expand...
Click to collapse
Based on this thread ( http://forum.xda-developers.com/showthread.php?t=941205 ), it seems it may take a few days for the tablets to register on the market.
I have 3 tablets and I'm trying to change the identifier for each tablet through the ro.product.model and seeing if each of the tablets will show up on the market. So far, only one tablet is showing on the web market, but it's still using the old ro.product.model identifier (GTablet-TnT-Lite).
However, the web market is still pretty wonky. Certain apps may refuse to install through the web market because of missing capabilities on our tablets, but will install just fine through the market app.

[Q] android App path

I have installed an Android Application which was developed by the friend of mine. It had installed on my Android phone (HTC G2, with Android 2.2). I need to locate the application forlders, and especially SQLite database which was created along with the application, because I need to copy it to my PC. I did seach on SD card but I did not found it, so I assume it must be on the device RAM, but I really don't know the structure and how the apps are organized. I might suspect the SQLites data filename, but that all I know at the moment.
Can somebody pint me to some utility which will allow to find the database, and the application path, and most of all to copy it to the PC ???
Thanks - Arthur
The database and any other "data" used by the app will be located in /data/data/ then inside a directory that corresponds to the app's package name. If we use the Kindle app as an example, the path to it's data would be: /data/data/com.amazon.kindle
unfortunately I checked this foldeor on RAM as well as SD and couldn't find it. device /data folder is empty, and SD gas some other stuff bot not this App.
aklisiewicz said:
unfortunately I checked this foldeor on RAM as well as SD and couldn't find it. device /data folder is empty, and SD gas some other stuff bot not this App.
Click to expand...
Click to collapse
I should have also said, you need to be rooted in order to see the contents of the /data directory. Without root access, it will be shown as empty because you do not have permission to view or modify. If your phone is rooted, you can use Root Explorer, Terminal Emulator, or adb to access /data and copy, modify, create, or delete files there.
Thank you for your time. That would explain why I do not see it.
OK, I have HTC G2 from T-Mobile, I think it has Android 2.2
Nothing was changed or updated on this phone since I bough it last fall. I'm not with T-Mobile anymore so I do not wat to mess up with the phone unless I'm really sure what am I doing. The only nice thing is that the phone is unlocked now. The reason I ask those questions is because I am working on some tool, which is a desktop program wchich supposed to sync SQLite data from device to the PC.
What I want to do is to connect the device through USB cable, then have it mapped is it normally does (i.e. drive H. Then access the SQLite file from the desktop application by opening the database through that link and syncing the records. Not sure but I hope this approach would work. If it cannot work that way then eventually I want to copy the SQLite dB file to the PC sync database and then copy it back to the device. I already have a desktop App which work on SQLite localy so now I want to access the device, having the same dB file residing on my android phone instead on my local HD.
What could be the reason that the installed APP doesn't want to move to SD ???
I would appreciate any suggestions...
What is required to root the phone? I've herd there are some risks. Besides I probably have to find some other solutions as none of the App users would want to root their devices (or have a knowledge how to do it).
aklisiewicz said:
Thank you for your time. That would explain why I do not see it.
OK, I have HTC G2 from T-Mobile, I think it has Android 2.2
Nothing was changed or updated on this phone since I bough it last fall. I'm not with T-Mobile anymore so I do not wat to mess up with the phone unless I'm really sure what am I doing. The only nice thing is that the phone is unlocked now. The reason I ask those questions is because I am working on some tool, which is a desktop program wchich supposed to sync SQLite data from device to the PC.
What I want to do is to connect the device through USB cable, then have it mapped is it normally does (i.e. drive H. Then access the SQLite file from the desktop application by opening the database through that link and syncing the records. Not sure but I hope this approach would work. If it cannot work that way then eventually I want to copy the SQLite dB file to the PC sync database and then copy it back to the device. I already have a desktop App which work on SQLite localy so now I want to access the device, having the same dB file residing on my android phone instead on my local HD.
What could be the reason that the installed APP doesn't want to move to SD ???
I would appreciate any suggestions...
What is required to root the phone? I've herd there are some risks. Besides I probably have to find some other solutions as none of the App users would want to root their devices (or have a knowledge how to do it).
Click to expand...
Click to collapse
Took me a bit to get back to you but figure better late than never...
Here is a good FAQ on rooting among other things specific to the G2(the US variant of the Desire Z). In order to root your G2, this guide looks to be good as he's simplified and automated a good bit of the process, should be safe, and seems to work. You'll need to install the two apps he mentions in step 1 and download the zip file he mentions in step 2 which is attached at the bottom of the post then just follow the instructions.
As for the database stuff, if you end up needing to access the /data directory you'll have to be rooted. Also, moving the app to the sdcard won't really help you with having access to the app's files. Froyo built-in App2SD just moves the apk file to a hidden directory on /sdcard (.android_secure) but the app data, cache and all that stuff will still be on internal memory. But to answer why the app won't move to the sd card, I'm guessing it's because the app itself must allow for it to be moved since by default, an app doesn't have this enabled unless the app dev gives it that ability.
To communicate with the phone, even with root access, you'll probably have to do so through adb commands or use an adb shell to be able to run shell commands on the phone. This would require adb be set up on the user's computer. If you want to play around with adb, there's a nice guide called ADB for Noobs that goes through setting it up and starting out using it. I can't say I've really done anything with SQLite databases on Android and certainly not then syncing it to a computer so I could be off-base or overlooking a workaround.
Thank you for your valuable information. You guys are really great help, and I appreciate your time. I will study the links provided.
In the meantime my main concern is to access SQLite database, as I need to get to the records, or at least be able to copy it back and forth between device an PC. I guess the database file would be something like MyDatabase.db , but I have no cule how to find it and copy it. As you have said it might be in some system protected directory. The main issue is that I will ne a solution which would work on every standard device (no the rooted one), so I need something very easy for the user to setup and follow. I have seen a utility that allow to manipulate SQLite records directly on device, but again thsi tools requires to root the phone (which I'm reluctant to do) because ot the above reasons. If you could help my to resove this I would be very graceful!
Arthur
aklisiewicz said:
Thank you for your valuable information. You guys are really great help, and I appreciate your time. I will study the links provided.
In the meantime my main concern is to access SQLite database, as I need to get to the records, or at least be able to copy it back and forth between device an PC. I guess the database file would be something like MyDatabase.db , but I have no cule how to find it and copy it. As you have said it might be in some system protected directory. The main issue is that I will ne a solution which would work on every standard device (no the rooted one), so I need something very easy for the user to setup and follow. I have seen a utility that allow to manipulate SQLite records directly on device, but again thsi tools requires to root the phone (which I'm reluctant to do) because ot the above reasons. If you could help my to resove this I would be very graceful!
Arthur
Click to expand...
Click to collapse
Unless there is some trick I don't know about you are going to have to be rooted to get access to the database. I found a couple links discussing this: here and here. The second link does mention that the app with the database you want to access could be written to store the database on the sdcard where it would then be accessible but that would be unsecure since anything could read/modify it there.
Thanks, looks like I have to do more research on my own. It is hard to believe for me that Google would not allow to access the same database from different Apps. I've seen there is a Java class ContentProvider which seems to allow that, so I will study this, perhaps it will help. Thank for you help.
Arthur

Web Browser With Black Background (Invert Colors / Night Mode) Through Proxy Filter

This is a solution for people looking to invert colors or force specific colors (e.g. white text / black background) on their web browser. Great for easier reading (especially at night) and saving power on OLED screens. CyanogenMod's browser has an invert colors option built in, but as far as I can tell, nobody has been able to port the CM browser to other ROMs. This solution works with any browser or ROM.
The basic idea is to run a web filter proxy such as Privoxy. Proxy filters are usually used for ad blocking, but they also have the power to completely rewrite a webpage. Privoxy is run in the background, and using the browser or WiFi/APN proxy settings, all web traffic is run through Privoxy. Privoxy rewrites the web pages based on the filters before it is displayed on your browser.
In the attached set, I've put together some badly-written but effective filters to force light text on black backgrounds. The filters rewrite the webpage so that the background is always black, text is always light gray, and links are always green. The filters only tweak the HTML/styles, so as a (usually) helpful side effect, the pictures remain unchanged. With my current configuration, Privoxy loads automatically in the background at startup, and all web pages run through Privoxy and are displayed in my designated colors. See the screenshots below to see it in action.
I put together a simple set of files that so folks can test this out.
Requirements
- You must have a rooted phone.
- You must be able to access proxy settings. Depending on your firmware, you might be able to set a proxy in Wireless and Network Settings (Wi-Fi settings -> Advanced, or Mobile Networks -> Access Point Names). You can also try an app like Transproxy or AutoProxy, or a browser that supports proxy settings, such as Firefox Mobile with the Proxy Mobile add-on.
Instructions
- Download and install Autostart (Root) from the Market.
- In your root folder, create a folder called /data/opt
- Download the attached "force_colors.zip" and extract the files
- Place all the files in /data/opt. Set appropriate permissions. (Privoxy and autostart.sh need to be executable.)
- Reboot your phone. Autostart should run the autostart.sh script (it will ask for superuser permission) and Privoxy will run in the background.
- Set your proxy host to localhost and the proxy port to 8118.
- If everything went correctly, all webpages should load in black background, light gray text and green links.
Note: If you use DroidWall or similar firewall settings, make sure that you allow access for "Applications running as root" so that Privoxy can access the network.
---
Note that these filters are infinitely customizable, if you know how to use regular expressions. Just edit force_colors.filter with the filters of your choice. For example, the Privoxy filters available here are specifically designed to invert some colors and make other ones darker, so you can still preserve some website colors in a more readable format.
In the next post, I'll describe everything I researched in pursuit of this solution. I am hoping others will pick up this project and make it into an easy-to-use package, and also to create some alternative filters to make them cleaner and/or more effective.
I think this feature is sorely needed in Android. Please pass the word to any developers who can help make it a reality!
[Note: This is my earlier post explaining what I did to make this solution work. Please note that I am a complete development noob! I hope this information is helpful and other people will improve on my solution.]
- There is an Android port of Privoxy on the Android Market called Privoxy (BETA 1). Install it and see if it works for you. On my phone, the app interface does not work. If I try to manually start Privoxy in a terminal window, it gives me a seg fault. Anyway, run the app once regardless, so that it copies the Privoxy files to the app data directory (/data/data/com.galoula.Privoxy/). We will use this directory as our base.
- A *working* Android port of Privoxy is included in Orbot: Tor on Android. (Tor uses Privoxy to pass the HTTP requests to a SOCKS proxy.) Download, install and run Orbot. You just need to run it once so that it copies the Privoxy binary to the app data folder.
- You'll find Orbot's Privoxy binary in /data/data/org.torproject.android/app_bin. Copy the "privoxy" binary and use it to replace the binary that came with Privoxy (BETA 1) (located in /data/data/com.galoula.Privoxy/bin). Set appropriate permissions. (We only installed Orbot for the binary, so you can uninstall Orbot now if you don't want it always loading in the background.)
- Now set up the filters. Download the attached force_colors.zip below. Extract the three files (force_colors.action, force_colors.filter, and privoxy_conf). Copy these files to /data/data/com.galoula.Privoxy/etc.
- Open a terminal window, navigate to /data/data/com.galoula.Privoxy/bin and start privoxy by running "./privoxy ../etc/privoxy_conf"
- By default, Privoxy will listen on port 8118. Go to your WiFi settings or APN settings. Set the Proxy name to "localhost" and the port to "8118". Now all web data will pass through Privoxy.
- Browse to a few websites and you'll see white text on black backgrounds! The default colors in the force_colors.filter are black for backgrounds, light gray for text, and green for links. Feel free to edit force_colors.filter to whatever color combination you prefer. I used HTML color names instead of hex codes to make it more readable.
- To run Privoxy every time at startup, I use an app from the Market called Autostart (Root). The directions are limited but basically, you just need to install the app and make a file called /data/opt/autostart.sh (set appropriate permissions). Then in autostart.sh, put this line: "/data/data/com.galoula.Privoxy/bin/privoxy /data/data/com.galoula.Privoxy/etc/privoxy_conf". The next time you reboot (might have to try it one or two times), Autostart will ask for superuser permission, and start Privoxy automatically.
Hope this is helpful for anybody else who wants to experiment.
hey claimui, this looks like a great approach! i'm looking forward to giving it a try this weekend and learning more about how the filtering works!
I spent a couple of days learning regular expressions (or at least some of them) and throwing together a simpler set of filters to force certain colors on a webpage. With this set, all backgrounds are black, all text is light grey, and links are green.
EDIT: My filters are now included in the force_colors.zip attached in the OP.
added to
black energy saving android apps for AMOLED screens
I made several updates to the original posts, including a suggestion on how to get Privoxy to start automatically on boot. After going through this whole process, this is a really effective solution. Privoxy starts automatically and invisibly whenever I start up my phone, and all of my webpages automatically pass through Privoxy and get displayed in my preferred colors.
For future tweaking, it would be nice to have a simple shortcut to enable/disable the filtering. (Although honestly I never want to disable it -- I always like my colors better!) Note that you can't simply kill Privoxy because your browser won't be able to find the proxy to connect to. So you either need a Privoxy command to toggle filtering on and off, or toggle the proxy settings to either use or bypass Privoxy.
In the meantime though, I think this still works really well. Hope others give it a try and can improve on the procedure.
Major update: I have finally consolidated all the steps into a small zip file and some simple instructions. You will need root access and a file manager or some basic knowledge of how to get around your phone. Just follow the instructions in the first post and you should be able to get it working very quickly.
Would like to test this but couldn't things to work...
Privoxy now updates to beta2.
Everything I try I get 404 Page can't loaded...
Have changed to localhost and port 8118 but doesn't work...
No need to install Privoxy from the Market. Just follow the instructions in my first post. After you install the Autostart app and put the files in the /data/opt folder, Privoxy will start at the next reboot.
Thx! Think it was a problem with SiyahKernel! After flashing from 2.0b2 to 2.0b3 now privoxy work!
Thx a lot! Have long time searched for something similar!
when I try to create the folder /data/opt it says it is created but in doesn't show up. also when I create the same folder and then move it to root folder it automatically renames it opt. I'm using root explorer.
In Root Explorer, first navigate to the /data folder, then click the button to Mount as R/W, then create the opt folder. Does that work?
Updated the OP to include some more suggestions for folks who are having trouble finding proxy settings. The basic options are:
1. See if your firmware comes with proxy settings. Under Wireless and Network Settings, look in Wi-Fi settings -> (menu button) Advanced, or Mobile Networks -> Access Point Names.
2. You can also try an app like Transproxy or AutoProxy.
3. Try a browser that supports proxy settings, such as Firefox Mobile with the Proxy Mobile add-on.
Nice.
Have you by any chance conducted a battery test or otherwise made any effort to notice the impact of this modification on battery life?
I haven't personally done any battery experiments (at least not for the browser) but this is a good reference: http://forum.xda-developers.com/showthread.php?t=660853
Basically yes, black backgrounds do save battery power on AMOLED screens. Personally I think the difference between 5% and 3% (or 3% and 2% at lower brightness) is not that big of a deal, probably not even noticeable in normal use. But if you want to squeeze the most milliwatts out of your battery then this will help.
To me the main benefit is that black backgrounds are just much easier to read, especially at night, and especially with the deep blacks / high contrast of the AMOLED screen.
Don't need 10 chars for this replay.
AWESOME!
Edit:
Sadly, from the time that passed since I posted this post, I stumbled upon a few annoying bugs.
1. Proccess locked at 50% cpu, (100% of a single core)
2. Some sites just don't work, and then I have to restart the browser.
Yes google mobile site everytime I would like to search something I get this Error:
This page contains the following errors:
error on line 3 at colum 31: AttValue: " or ' expected
Reparse document as HTML
I know regexp pretty well, but Privoxy syntax is a little bit confusing.
I'm trying to figure out the filters supplied by the OP, and they are just too confusing
To OP : How do you set the delimiter for the filters in Privoxy?
I know / and | are possible, are you using + for some reason?
All your filters start with s+, what is the + ?
Great work. Autostart didn't work on my Galaxy Note for some reason.
But maybe changing CSS is easier. This method works on Opera Mobile:
http://forum.xda-developers.com/showthread.php?t=1326434
eitama said:
Sadly, from the time that passed since I posted this post, I stumbled upon a few annoying bugs.
1. Proccess locked at 50% cpu, (100% of a single core)
2. Some sites just don't work, and then I have to restart the browser.
Click to expand...
Click to collapse
Hm, I haven't encountered these bugs. I am using the same files that I uploaded in the zip. Does it only happen with certain sites? Maybe I just need to tweak the filters. My regexp is poor so they are very crude, and could easily screw up some sites.
bgx said:
Yes google mobile site everytime I would like to search something I get this Error:
This page contains the following errors:
error on line 3 at colum 31: AttValue: " or ' expected
Reparse document as HTML
Click to expand...
Click to collapse
Can you tell me the specific URL? I notice you're on T-Mobile so maybe you have a carrier-specific browser/search settings.
eitama said:
I know regexp pretty well, but Privoxy syntax is a little bit confusing.
I'm trying to figure out the filters supplied by the OP, and they are just too confusing
To OP : How do you set the delimiter for the filters in Privoxy?
I know / and | are possible, are you using + for some reason?
All your filters start with s+, what is the + ?
Click to expand...
Click to collapse
Privoxy syntax is supposed to be like Perl -- well I don't know Perl so I'm just copying what I read. The basic reference is here: http://www.privoxy.org/user-manual/filter-file.html
In my filters, I'm using + as the delimiter. In Privoxy you can use whatever delimiter you want, and it doesn't make a difference (I think). I just copied the + from another filter set -- probably because it's easier to read than / when working with HTML.
The first couple of filters should not be too hard to figure out. For example:
Code:
# Set default colors
s+<body+<body bgcolor=black text=LightGray link=LimeGreen vlink=Green+isUg
This just makes sure every <body> tag starts with "<body bgcolor=black text=LightGray link=LimeGreen vlink=Green" (very crude, I know). The isUg at the end are the modifiers:
i = case insensitive matching
s = allow string to span multiple lines
U = ungreedy matching
g = global matching
Two filters substitute a tag with "JED-C-Anchor-color". This is not a valid tag; the browser will just skip it so the effect is basically the same as deleting the tag. Substituting instead of deleting just makes debugging easier. I used "JED-C" because I modified these filters from http://members.cox.net/pu61ic.1inux.dunc4n/software/privoxy.jed
tamarian said:
But maybe changing CSS is easier. This method works on Opera Mobile:
http://forum.xda-developers.com/showthread.php?t=1326434
Click to expand...
Click to collapse
Thanks for the tip! Yeah I know about changing CSS and that would be a better solution. But I don't think there is a way to change the CSS with the stock browser, and some people still like using the stock Samsung browser for hardware acceleration or whatever other reason. But maybe somebody could make a Privoxy filter that adds the same CSS code into all webpages?

[Guide] Multi User Setup for Kitkat 4.4.4 (for noobs)

This tutorial will show you how to setup your device as admin and configure other user profiles (this is important when you're not the owner). Your device maker disabled multiuser functionality in Kitkat, like on my Lenovo Tab 2 A10-70L? - then this for you. At least, that's where this procedure is tested on. Afaik, this should work on Lollipop too. But will it work for your device? - No clue, you tell us!
Basically it's an accumulation of what I've read here (thanks again) and my personal experience as a noob myself.
So far, this guide is incomplete and I'm hoping for some pro tipps to perfect it. Please help me sort out the unclear parts highlighted in red and I'll update this post accordingly. The sooner the better, because this actually is not my device and someday soon I'll have to pass it over to my mom since it's my present to her, I'm only setting this slab up...
Preconditions:
Android treats the first account created as "owner". Only owner will have root privileges if installed accordingly (=admin).
Root permission and a file manager (e.g. ES File Explorer) are required for this fix so go get that first. For the Lenovo Tab 2 A10-70L, I followed this beautiful guide, besides that, I can't help much here.
Unable/uninstall all bloatware (I was adventurous with Titanium Backup with no probs so far, but some crap remained from looking at new user folders; still in search of a vendor/device-specific "save to remove" list)
Install ALL apps you and the other users suppesdly need. This will avoid the need to redownload and reinstall all the apps for each and every user wasting storage. Think thrice, usually it'll be more than desired, but better you do it instead of a DAU... Each user will be able to install apps later though. Full control over user restrictions can be applied for "guest profile" only.
Steps:
In file explorer, go to /system/ and open build.prop
Check if you have anything like the below text (you shouldn't, otherwise edit accordingly) and add these lines at the end of it:
Code:
# Multi Users
fw.max_users=[COLOR="DarkGreen"]X[/COLOR]
fw.show_multiuserui=1
Replace X with your desired digit (up to 7?)
(I've read somewhere that 7 users is maximum that system can handle, but I haven't tried)
Save, reboot and log in as "owner" (your profile)
Go to Settings>Device and say hello to new item "Users"
Create new users and/or a guest profile (important: write down the order in which you created them!)
All new user profiles are now shown as "new user" no matter what you wrote in the profile properties (only guest will be shown as "guest"). Mind you, this also applies for the lockscreen!
In file explorer, go to /data/system/users/ to find your users' folders containing some system files (what exactly?) Now guess what - the order of the numbered folders and #.xml files match the order you created them. "0" is you, the owner.
Open each .xml file and replace "Owner" with "Your Name" and "New user" with "Username"
Put the device to sleep, trigger lockscreen and log in to each user profile and
Pull down shortcut menu from top right and enable autorotate
Go to Settings>Users>Security, check all settings and note each unlock-code
Disable background services like sync, location, etc. that could potentionally drain battery where applicable
Rinse & repeat 8) for all new profiles
Install "Multi-User App Share" and set apps per user. (Or is there a newer app or more hackish approach without the need for xposed or compiling stuff etc.?)
= DONE =
If you want the user icon in status bar, follow http://forum.xda-developers.com/gal...-users-mod-t3017782/post58659868#post58659868 (haven't tried that ).
Well... build.prop fixes are working, at least for me. It's good alternative to multi-user app from Xposed (we don't want to use Xposed too much...).
Still tried with decompiling & compiling framework for fixing icon problem, and... in framework-res there is not status_bar_expanded_header.xml file, se we are in deep ****.
I am working on: LP

(Use case within) Most suitable no-root packet capture app? Or should I get back into development again?

TLDR: Got new phone, don't want to root now but still want to do things I needed root for. I need a non-root packet capture solution, or to decide if I should still root my new phone, or to get into development again. What is my best option? Use case below.
I have always rooted my phones which have always been as easy as 'fastboot oem unlock'. Not with ROG3. It needs an OEM tool and from what I read here I only get one chance.
After all the years though my uses of root fall into one of 3 categories: ad blocking, back up, and one specific case of packet capture.
I used AdAway for DNS level ad blocking. Private DNS with dns.adguard.com seems to be fine for that. Easy enough to set up.
Backup is with Titanium Backup. I am going to install all apps I ever had on my last phone (which has root and Ti) hoping that the stock transfer tool would pick them up and carry them over. Storage is not an issue; I have 512G. Apps I really don't care about anymore can be deleted later.
Next, my sticking point: Packet capture.
For that I have been running a tcpdump binary inside Terminal Emulator a week at a time. I am after the network traffic of one game, which I am not going to name for fear of ruining the fun. Its traffic has been in clear HTTP since I started playing in 2015. Through it I have gathered how units level up, enemy patterns in battles, and scripts for story scenes. I so enjoyed having these data that I kept playing, as long as it remains viable. My setup writes a pcap file to external storage that I can copy to my laptop for analysis. I configured tcpdump to capture only traffic to/from one IP to save space.
To get the same functionality I need a packet capture app to capture only the game's traffic, and save one pcap file per session. I tried 3 such apps and they all fall short in one way or another.
TPacketCapture captures all; app filter is its very expensive paid feature. Plus it stalls all traffic within 3 minutes of starting.
Greyshirts SSL Packet Capture splits capture by HTTP streams. Each must be selected manually for export with no option for a whole session export. Is a problem because every transaction of the game is its own HTTP stream. Is also a known beef among users and author seems unwilling to address. It keeps its data files to itself; I was only able to get them via root and they are not straight pcap, yet not difficult to figure out. It does decode the game traffic very nicely, to the point it becomes human-readable.
PCAPDroid does not save files; it only streams off its builtin HTTP server or UDP. I could not get useful capture out of it, but it is open source, so I could try adding that feature myself, hence the question of getting into development.
I did find a way to mass export data out of Greyshirts. I can use adb backup to back up that entire app's data. Then I found information on how to extract from it the data files it kept to itself. Then because those data is in a lighter format than pcap, it's actually easier for me to script a parser and work on them directly!
-- EDIT --
I found that some public wifi break if used with a private DNS.
Then for some time I totally lost adb backup functionality! I would get an empty backup even though everything else goes as expected. I resigned to defer moving that game over and set up Android Studio to start that development work I mentioned (in essence, attempt to modify PCAPDroid to save captures to external storage and add AdAway functionality).
Instead of using just the command line tools like I always have, I installed Android Studio. The SDK tools got updated along the way to 1.0.41 on SDK Tools 30.0.5 (I got the "ADB backup deprecated" message too, but the [email protected]% I care) . Then when I tried adb backup again I got my full backups again.
-- END EDIT --
I think there's my solution and I can now go without rooting. If I do need root in the future, adb backup should save the day.

Categories

Resources