Game Development Reference
In-Depth Information
just filter by hardware type so that our OpenGL ES 1.x code gets enough processing power.
Here's how we can do this:
<uses-feature android:glEsVersion=" 0x00020000 "android:required=" true "/>
This will make our game only show up on devices that support OpenGL ES 2.0 and are thus
assumed to have a fairly powerful graphics processor.
Note This feature is reported incorrectly by some devices out there, which will make your
application invisible to otherwise perfectly fine devices. Use it with caution.
Let's say you want to have optional support of USB peripherals for your game so that the device
can be a USB host and have controllers or other peripherals connected to it. The correct way of
handling this is to add the following:
<uses-feature android:name=" android.hardware.usb.host " android:required=" false "/>
Setting " android:required " to false says to Google Play, “We may use this feature, but it's
not necessary to download and run the game.� Setting usage of the optional hardware feature
is a good way to future-proof your game for various pieces of hardware that you haven't yet
encountered. It allows manufacturers to limit the apps only to ones that have declared support
for their specific hardware, and, if you declare optional support for it, you will be included in the
apps that can be downloaded for that device.
Now, every specific requirement you have in terms of hardware potentially decreases the number
of devices on which your game can be installed, which will directly affect your sales. Think twice
before you specify any of the above. For example, if the standard mode of your game requires
multitouch, but you can also think of a way to make it work on single-touch devices, you should
strive to have two code paths—one for each hardware profile—so that your game can be
deployed to a bigger market.
The <uses-sdk> Element
The last element we'll put in our manifest file is the <uses-sdk> element. It is a child of the
<manifest> element. We defined this element when we created our Hello World project in
Chapter 2 and made sure our Hello World application works from Android 1.5 onward with
some manual tinkering. So what does this element do? Here's an example:
<uses-sdk android:minSdkVersion=" 3 " android:targetSdkVersion=" 16 "/>
As we discussed in Chapter 2, each Android version has an integer assigned, also known as
an SDK version . The <uses-sdk> element specifies the minimum version supported by our
application and the target version of our application. In this example, we define our minimum
version as Android 1.5 and our target version as Android 4.1. This element allows us to deploy
an application that uses APIs only available in newer versions to devices that have a lower
version installed. One prominent example would be the multitouch APIs, which are supported
from SDK version 5 (Android 2.0) onward. When we set up our Android project in Eclipse, we
 
Search WWH ::




Custom Search