Restrict sales of an app by specific devices?
Is it possible to restrict sales of an app on the Android Market by specific devices, or by features of a device (screen resolution, processor,开发者_JAVA技巧 diskspace etc..)?
I know that I'm going to be bombarded by people saying that if you design your app well, it should be able to run on any size device. That's all fine and well, but there are reasons that you might still want to restrict by feature set.
One reason that comes readily to mind is screen resolution. Clearly, not all apps work on all screen sizes, especially if you have a lot of images that have been crafted to take full advantage of a larger screen resolution. To belabor the point, imagine that tomorrow a new Android device comes out with a screen resolution of 100x100. Clearly there are apps that will not work optimally on this device. As a developer, I want to ensure that my application runs only on devices that have the features I require to support the best possible experience.
I don't want to sell it to users with certain devices to prevent negative ratings and reviews that I frequently see on other apps. I'd rather ship a perfect experience on a smaller number of devices than allow imperfect experiences on all of them.
Does Android Market offer any means of dealing with this?
I think you can do what you need in your AndroidManifest file. For example, you can choose to only support extra large screens resolution like this:
<supports-screens android:resizeable="false"
android:smallScreens="false"
android:normalScreens="false"
android:largeScreens="false"
android:xlargeScreens="true"
android:anyDensity="true" />
These sizes are defined in the link below, for example "normal" is HVGA at medium density. Read the link below for more details.
http://developer.android.com/guide/topics/manifest/supports-screens-element.html
"If your application does not support small screens, then there isn't much the system can do to make the application work well on a smaller screen, so external services (such as Android Market) should not allow users to install the application on such screens."
You may also need to set the element, although I've not tried that myself, it seems to be in-line with what you want:
http://developer.android.com/guide/topics/manifest/compatible-screens-element.html
"The Android system does not read the manifest element (neither at install-time nor at runtime). This element is informational only and may be used by external services (such as Android Market) to better understand the application's compatibility with specific screen configurations and enable filtering for users. Any screen configuration that is not declared in this element is a screen with which the application is not compatible. Thus, external services (such as Android Market) should not provide the application to devices with such screens."
You'll want to read up more here as well to see what the Market does with all this info:
http://developer.android.com/guide/appendix/market-filters.html
Since I've not tried this, it's not clear to me whether your app should use both the elements I mentioned above, but the market filter page probably explains which to use.
This is covered fairly well in the developer documentation, particularly the pages linked to in the "See Also" box.
精彩评论