Showing posts with label API Level 13. Show all posts
Showing posts with label API Level 13. Show all posts

How to Determine if Android Device Support Portrait Orientation Screens

public static final String FEATURE_SCREEN_PORTRAIT was added in API level 13
Feature for getSystemAvailableFeatures() and hasSystemFeature(String).
The device supports portrait orientation screens. For backwards compatibility, you can assume that if neither this nor FEATURE_SCREEN_LANDSCAPE is set then the device supports both portrait and landscape.
Constant Value: "android.hardware.screen.portrait"


1. Get a PackageManager Instance named myPackageManager.

2. Create a Boolean Variable named bolPortraitSupported. 

3. Set the Minimum and Target SDK version  to 13 or greater. 

4. In the onCreate method, add the below code. This will return the portrait ability to a boolean named bolPortraitSupported. It will then display a toast displaying the portrait ability of the device to the user.

bolPortraitSupported = myPackageManager.hasSystemFeature(PackageManager.FEATURE_SCREEN_PORTRAIT);
if (bolPortraitSupported) {
Toast.makeText(this, "Device supports portrait orientation screens", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "Device does NOT support portrait orientation screens!", Toast.LENGTH_LONG).show();
}

5. Compile and run!

Resources:
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_SCREEN_PORTRAIT

How to Determine if Android Device Supports Landscape Orientation

public static final String FEATURE_SCREEN_LANDSCAPE was added in API level 13
Feature for getSystemAvailableFeatures() and hasSystemFeature(String).
The device supports landscape orientation screens. For backwards compatibility, you can assume that if neither this norFEATURE_SCREEN_PORTRAIT is set then the device supports both portrait and landscape.
Constant Value: "android.hardware.screen.landscape"


1. Get a PackageManager Instance named myPackageManager.

2. Create a Boolean Variable named bolLandscapeSupported. 

3. Set the Minimum and Target SDK version  to 13 or greater. 

4. In the onCreate method, add the below code. This will return the landscape ability to a boolean named bolLandscapeSupported. It will then display a toast displaying the landscape ability of the device to the user.

bolLandscapeSupported = myPackageManager.hasSystemFeature(PackageManager.FEATURE_SCREEN_LANDSCAPE);
if (bolLandscapeSupported) {
Toast.makeText(this, "Device supports landscape orientation screens", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "Device does NOT support landscape orientation screens!", Toast.LENGTH_LONG).show();
}

5. Compile and run!

Resources:
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_SCREEN_LANDSCAPE

How to Determine if Android Device has FakeTouch Multitouch Jazzhand Feature

public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND was added in API level 13
Feature for getSystemAvailableFeatures() and hasSystemFeature(String): The device does not have a touch screen, but does support touch emulation for basic events that supports tracking a hand of fingers (5 or more fingers) fully independently. This is an extension of FEATURE_FAKETOUCH for input devices with this capability. Note that unlike a multitouch screen as defined by FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND, not all two finger gestures can be detected due to the limitations described for FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT.
Constant Value: "android.hardware.faketouch.multitouch.jazzhand"

1. Get a PackageManager Instance and save to myPackageManager.

2. Create a Boolean Variable named bolFMJSupported. 

3. Set the Minimum and Target SDK version  to 13 or greater. 

4. In the onCreate method, add the below code. This will return the faketouch mutlitouch jazzhand ability to a boolean named bolFMJSupported. It will then display a toast displaying the faketouch multitouch jazzhand ability on the device to the user.

bolFMJSupported = myPackageManager.hasSystemFeature(PackageManager.FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND);
if (bolFMJSupported) {
Toast.makeText(this, "Device has Faketouch multitouch jazzhand ability", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "No Faketouch multitouch jazzhand ability!", Toast.LENGTH_LONG).show();
}

5. Compile and run!

Resources:
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND

How to Determine if Android Device has FakeTouch Multi-Touch Distinct Feature

public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT was added in API level 13
Feature for getSystemAvailableFeatures() and hasSystemFeature(String): The device does not have a touch screen, but does support touch emulation for basic events that supports distinct tracking of two or more fingers. This is an extension of FEATURE_FAKETOUCH for input devices with this capability. Note that unlike a distinct multitouch screen as defined by FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT, these kinds of input devices will not actually provide full two-finger gestures since the input is being transformed to cursor movement on the screen. That is, single finger gestures will move a cursor; two-finger swipes will result in single-finger touch events; other two-finger gestures will result in the corresponding two-finger touch event.
Constant Value: "android.hardware.faketouch.multitouch.distinct"

1. Get a PackageManager Instance and save to myPackageManager.

2. Create a Boolean Variable named bolFMDSupported. 

3. Set the Minimum and Target SDK version  to 13 or greater. 

4. In the onCreate method, add the below code. This will return the faketouch mutlitouch distinct ability to a boolean named bolFMDSupported. It will then display a toast displaying the faketouch multitouch distinct ability on the device to the user.

bolFMDSupported = myPackageManager.hasSystemFeature(PackageManager.FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT);
if (bolFMDSupported) {
Toast.makeText(this, "Device has Faketouch multitouch distinct ability", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "No Faketouch multitouch distinct ability!", Toast.LENGTH_LONG).show();
}

5. Compile and run!

Resources:
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT