Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

How to identify Android stock browser?

How to identify Android stock browser?

I just saw that metamodpro can identify browsers. How do I script a query to see if the browser is the Android stock browser?

...ideally I'd prefer to do a double check that the device is android and that the browser is the stock browser...

Thanks
----
In the meantime, following the style of queries I'd seen in the recepies and forum, I created 2 versions of my module (one with css for the Android stock browser and one without it), and tried these two variations but neither caused the Android browser version to be displayed:

if ( $core_genius->check( "browser_type = android" ) ) return 128; else return 167;

if ( $core_genius->check( "browser_type = chrome" )
   and $core_genius->check( "browser_version < 19" ) ) return 128; else return 167;

As per a blog post I saw, Chrome versions from 18 downward are supposed to be the Android stock browser but I wasn't able to get that approach to work...

tap21
Junior Modder
ranks
useravatar
Offline
20 Posts
Administrator has disabled public posting

Re: How to identify Android stock browser?

Hi Tap21,

thanks for your question. I think I'd want to know more about what the "android stock browser" actually means in practice, particularly what its user agent is. I am not sure (until I see it!) that this is going to be as consistent as you think it is – but I am prepared to be wrong about that smile

To get the user agent, use the following in MetaMod:

echo "user agent is: " . htmlentities($_SERVER['HTTP_USER_AGENT']) . "<br>";

then view it with as many different devices as you can that use the "stock browser". Can you please report the results?

Thanks,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3313 Posts
User info in posts
Administrator has disabled public posting

Re: How to identify Android stock browser?

Thanks Stephen: yes, reading further on the net it looks like identifying it is not so straightforward... Is there a way then to identify the Chrome browser on an Android device?

tap21
Junior Modder
ranks
useravatar
Offline
20 Posts
Administrator has disabled public posting

Re: How to identify Android stock browser?

Do some testing with the user agent thing I sent earlier, and see what results you get. The more devices you can try, the better, but even trying a couple will give you something that you can search for on Google and hopefully that will show up something.

At the end of the day what are you needing to achieve? Why does the stock browser matter to your site? Are you looking for the stock browser itself, or for the times when people are *not* using it, or what? It might pay to go back to this question to find better ways of achieving the same thing.

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3313 Posts
User info in posts
Administrator has disabled public posting

Re: How to identify Android stock browser?

When I use the custom HTML module in Joomla, the stock browser renders the text super-small while on Android Chrome it appears fine, so I'm trying to find a fix for this.

But how do I script a query (whether to detect one browser or the other) using the code you provided (or the output that it's supposed to yield)?

I'm trying to use metamodpro because other methods like modernizr and javascripts haven't worked...

tap21
Junior Modder
ranks
useravatar
Offline
20 Posts
Administrator has disabled public posting

Re: How to identify Android stock browser?

If you are going to change CSS (for example) or switch to a different module based on browser detection, then you need to be able to identify the browser, so experimenting with the code I gave earlier is just the first step to finding a pattern of user agents that indicate the type of browser you are looking for.

However it would seem more productive to me to find out exactly what's going on with the CSS and rendering of those HTML modules. Do you have any tools for examining the HTML/CSS in the browser that's rendering it wrongly?

And how is the rest of your page – rendering text at correct size or not?

If it's just the custom HTML modules that are rendering things wrongly then it should not be toooo hard to get the CSS right.

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3313 Posts
User info in posts
Administrator has disabled public posting

Re: How to identify Android stock browser?

The rendering problem is with text elements from modules: any custom HTML modules I add, the Joomla breadcrumbs... But things like navigation and even the whole virtuemart display render fine... Chrome seems to inherit the font size from the source CSS while the stock browser requires me to "reset" the size because it otherwise resorts to a tiny size.

Regarding Android stock browser user agents, I found this link: Android Webkit Browser User Agent Strings

tap21
Junior Modder
ranks
useravatar
Offline
20 Posts
Administrator has disabled public posting

Re: How to identify Android stock browser?

update: I may have found a 'creative' solution.

I stumbled upon a certain phenomenon when changing the text layout into a multi-column table format. Once done, text renderered more or less well between the Android stock and Chrome browsers (and of course on PC and iOS). Researching more I see that there is such a phenomenon with the Android OS (see the single column rendering comment here: http://android.stackexchange.com/questi … ettings-do).

I've gone ahead and started creating 2 versions of my text modules - one for Android and one for all other browsers using this kind of callup: if ( $core_genius->check( "browser_type = android" ) ) return 160; else return 169;

It works well except that my LG v400 tablet is rendering the non-Android version of the module. Do you have any idea why that's happening? My Xperia t26i on the other hand is rendering the Android version of the module like it should...

tap21
Junior Modder
ranks
useravatar
Offline
20 Posts
Administrator has disabled public posting

Re: How to identify Android stock browser?

Hi,

can you get hold of the user agent of the LG v400 tablet browser? My guess is that it does not mention Android in the user agent.

echo "user agent is: " . htmlentities($_SERVER['HTTP_USER_AGENT']) . "<br>";

It's not fantastic to put in particular exceptions for specific devices, as there will be hundreds of others out there that may have similar issues that you just don't know about. However you may see a pattern by looking at the LG one. e.g. there might be something that defines it as a tablet, which in most cases means that it's Android (unless it's specifically an iPad).

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3313 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5913
Dormant:
User Info:
 
Total Users:
10778
Newest User:
negina4qx
Members Online:
0
Guests Online:
108

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked