Title: [Plugin: PHP Browser Detection] How to detect Android Devices
Last modified: August 20, 2016

---

# [Plugin: PHP Browser Detection] How to detect Android Devices

 *  [steckinsights](https://wordpress.org/support/users/steckinsights/)
 * (@steckinsights)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-php-browser-detection-how-to-detect-android-devices/)
 * Great plugin! This resource has been a **huge** help.
 * How would one go about detecting an Android device? or other mobile device makers
   for that matter?
 * I’ve tried `is_mobile`, but that does not seem to pinpoint Android devices. Any
   thoughts?
 * [http://wordpress.org/extend/plugins/php-browser-detection/](http://wordpress.org/extend/plugins/php-browser-detection/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [steckinsights](https://wordpress.org/support/users/steckinsights/)
 * (@steckinsights)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-php-browser-detection-how-to-detect-android-devices/#post-2245121)
 * I added this to “php-browser-detection.php” and it seems to work when viewing
   through my browser (using the User Agent/Developer settings for Android devices),
   but isn’t working on the phone:
 *     ```
       function is_android (){
       	$browserInfo = php_browser_info();
       	if (preg_match("/Android/", $browserInfo['browser_name_pattern'], $matches)) {
       		if ($version == '') :
       			return true;
       		elseif ($browserInfo['majorver'] == $version ) :
       			return true;
       		else :
       			return false;
       		endif;
       	} else {
       		return false;
       	}
       }
       ```
   
 * This isn’t working, but I feel as if I’m on the right track. Any help is appreciated.
 *  Plugin Author [MartyThornley](https://wordpress.org/support/users/martythornley/)
 * (@martythornley)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-php-browser-detection-how-to-detect-android-devices/#post-2245345)
 * Whenever I add a new function to find a browser, I first try echoing the browser
   info to the screen and then find something that identifies that specific browser.
 * Try using this…
 *     ```
       $browserInfo = php_browser_info();
       print '<pre>'; print_r( $browserInfo ); print '</pre>';
       ```
   
 * Place that somewhere publicly visible like the page template in your theme. Then
   view the site on the different browsers and you should see the specific info 
   for each. Then change that preg_match line to find it.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: PHP Browser Detection] How to detect Android Devices’ is closed
to new replies.

 * ![](https://ps.w.org/php-browser-detection/assets/icon-256x256.png?rev=999338)
 * [PHP Browser Detection](https://wordpress.org/plugins/php-browser-detection/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/php-browser-detection/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/php-browser-detection/)
 * [Active Topics](https://wordpress.org/support/plugin/php-browser-detection/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/php-browser-detection/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/php-browser-detection/reviews/)

## Tags

 * [android](https://wordpress.org/support/topic-tag/android/)

 * 2 replies
 * 2 participants
 * Last reply from: [MartyThornley](https://wordpress.org/support/users/martythornley/)
 * Last activity: [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-php-browser-detection-how-to-detect-android-devices/#post-2245345)
 * Status: not resolved