(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-5276656-4', 'mobileesp.com'); ga('send', 'pageview');

Updated: PHP, JavaScript, Java & ASP.NET

Hi, folks —

Summer is here! And the mobile device avalanche is just about ready to begin in earnest…

There were a few outstanding things that needed to be taken care of, especially some refactoring among the Android detection methods. These were significant changes, so please be sure to review your implementation before upgrading to the latest version!

Here’s a summary of the important code updates. Check the Change Log in the source code for a longer description.

  • DetectIos(): This is a brand new function for all libraries. Returns TRUE for iPhones, iPod Touches, and iPads. The other platforms have a generic check available rather than by screen size class, so I thought it was good to add this in.
  • DetectAndroid(): The purpose of this function has been changed. Now, this method returns TRUE for *any* Android device: phone, multi-media player, tablet, or Google TV. Updated in all libraries.
  • DetectAndroidPhone(): This is a brand new function for all libraries. Its equivalent in the iOS world is DetectIphoneOrIpod(). This method ought to return TRUE for the smaller form factor devices (generally 7″ and less) such as phones and multi-media players (e.g., Samsung Galaxy Player, HTC Flyer). The logic follows Google’s recommendation of checking for the presence of both “Android” and “mobile” in the user agent string.
  • DetectAndroidTablet(): This function has been updated in all libraries.┬áThe logic follows Google’s recommendation of checking for the presence of both “Android” but not “mobile” in the user agent string.
  • The various BlackBerry functions: I noted in the code explicitly which ones should return TRUE for the PlayBook and which shouldn’t.
  • HTC Flyer: HTC has released their new 7″ Android tablet. My testing device was purchased at Best Buy last week. The device keeps reporting itself as a desktop Mac — it doesn’t even include the word “Android” in the user agent string. So I added some special checks in the Android methods for this device to ensure it’s detected properly.

As always, please help me check for errors & bugs. I can do a light test of the PHP and JavaScript code libraries, but I don’t have access to servers to check the APS.NET or Java code libraries. Please let me know if you find something. Much obliged!

– Anthony

Owner of the MobileESP project. For the latest source code downloads, visit: https://github.com/ahand/mobileesp

Posted in Code Updates, MobileESP APIs

Leave a Reply

Your email address will not be published. Required fields are marked *