How to determine if the client is a touch device [duplicate]

You can use the following JS function: function isTouchDevice() { var el = document.createElement(‘div’); el.setAttribute(‘ongesturestart’, ‘return;’); // or try “ontouchstart” return typeof el.ongesturestart === “function”; } Source: Detecting touch-based browsing. Please note the above code only tests if the browser has support for touch, not the device. Related links: How to detect a mobile device … Read more

App not compatible with tablet

The tablet may not support some of the features that your app requires. You can make them “not required” for the app (that means that you should check if they are actually available before using them in the code). It is done like that: <!– features –> <uses-feature android:name=”android.hardware.telephony” android:required=”false” /> Other possible features are: … Read more

Make android app not availble for tablets

http://developer.android.com/guide/practices/screens-distribution.html#FilteringHansetApps …you can use the element to manage the distribution of your application based on combinations of screen size and density. External services such as Google Play use this information to apply filtering to your application, so that only devices that have a screen configuration with which you declare compatibility can download your application. The … Read more

Is there a way to hide the system/navigation bar in Android ICS

Check out SYSTEM_UI_FLAG_HIDE_NAVIGATION, this flag hides the navigation bar until the user interacts with the device. It was introduced in Android 4.0. You can enable this flag for example like this: getWindow().getDecorView() .setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); Note that the navigation won’t disappear again automatically, you have to set it every time after the user interacted with the device. … Read more

Emulate Samsung Galaxy Tab

UPDATED: Matt provided a great link on how to add emulators for all Samsung devices. OLD: To get the official Samsung Galaxy Tab emulator do the following: Open the Android SDK and AVD Manager Click on Available packages Expand the Third party Add-ons. There you will see Samsung Electronics add-ons. Once the add-on is installed … Read more

JavaScript how to check User Agent for Mobile/Tablet

First – improving the condition if (navigator.userAgent.match(/iPad/i)) { // do tablet stuff } else if(navigator.userAgent.match(/Android|webOS|iPhone|iPod|Blackberry/i) ) { // do mobile stuff } else { // do desktop stuff } Second, adding the missing keywords: if (navigator.userAgent.match(/Tablet|iPad/i)) { // do tablet stuff } else if(navigator.userAgent.match(/Mobile|Windows Phone|Lumia|Android|webOS|iPhone|iPod|Blackberry|PlayBook|BB10|Opera Mini|\bCrMo\/|Opera Mobi/i) ) { // do mobile stuff } else … Read more

Navigation Drawer: set as always opened on tablets

Based on the idea of larger devices could have different layout files, I have created the follow project. https://github.com/jiahaoliuliu/ABSherlockSlides HighLights: Since the drawer of a large device is always visible, there is not need to have an drawer. Instead, a LinearLayout with two elements with the same name will be enough. <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent” … Read more