I am creating a PHP API for an Android application and want to make it so the API only proceses requests from Android devices. Is there some sort of logic I could use to make this happen?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
you can use Mobile_Detect which is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment. by using this PHP lib you can dectect following devices:
Phones
* isiPhone()
* isBlackBerry()
* isHTC()
* isNexus()
* isDellStreak()
* isMotorola()
* isSamsung()
* isSony()
* isAsus()
* isPalm()
* isGenericPhone()
Tablets
* isBlackBerryTablet()
* isiPad()
* isKindle()
* isSamsungTablet()
* isHTCtablet()
* isMotorolaTablet()
* isAsusTablet()
* isNookTablet()
* isAcerTablet()
* isYarvikTablet()
* isGenericTablet()
Operating systems
* isAndroidOS()
* isBlackBerryOS()
* isPalmOS()
* isSymbianOS()
* isWindowsMobileOS()
* isiOS()
* isFlashLiteOS()
* isJavaOS()
* isNokiaOS()
* iswebOS()
* isbadaOS()
* isBREWOS()
Mobile browsers
* isChrome()
* isDolfin()
* isOpera()
* isSkyfire()
* isIE()
* isFirefox()
* isBolt()
* isTeaShark()
* isBlazer()
* isSafari()
* isMidori()
* isGenericBrowser()
or see this tutorial for Detecting Mobile Devices Using PHP:
http://www.hand-interactive.com/resources/detect-mobile-php.htm