This issue has already been resolved here : What is the best way to detect a mobile device in jQuery?.
On the accepted answer, they basically test if it's an iPhone, an iPod, an Android device or whatever to return true. Just keep the ones you want for instance if( /Android/i.test(navigator.userAgent) ) { // some code.. }
will return true only for Android user-agents.
However, user-agents are not really reliable since they can be changed. The best thing is still to develop something universal for all mobile platforms.