Android 应用程序有什么方法可以知道它安装在哪个设备上吗?
假设我想针对特定的几个 Android 设备(例如平板电脑),有什么方法可以让应用程序知道它安装在哪个设备上?我的意思是我希望应用程序知道设备具有哪些功能,例如前置摄像头、屏幕分辨率等。最好能够知道应用程序正在使用的确切设备,因为这会有所帮助使应用程序真正可用;)。
如果这听起来很荒谬,那么作为 Android 开发人员,您可以在发布应用程序时指定您希望该应用程序在哪些设备上可用吗?
我想最终我可以在应用程序描述中的“插入设备名称”中用大写字母书写 EXCLUSIVE TO 或 AVAILABLE 。
提前致谢。
Suppose I wanted to target a specific few Android devices (e.g. tablet), is there any means for an app to know which device its installed in? I mean I would like the app to know what kinds of features the device has, for example, front facing camera, screen resolution, etc. It would be best to be able to know the exact device the app is working in as it would help make the app actually usuable ;).
If that sounds ridiculous, as an Android developer can you specify when you publish your app which device(s) you want the app available in?
I guess ultimately I could write in capitals EXCLUSIVE TO or AVAILABLE IN "insert device name" in the app description.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试...
Try...
如果您想为平板电脑设计应用程序,您应该考虑屏幕尺寸。
您可以使用 Resources.getConfiguration().screenLayout 找出屏幕尺寸:
http://developer.android.com/reference/android/content/res/Configuration.html#orientation
请注意,您的第一个决定将是您认为平板电脑的尺寸是 SCEENLAYOUT_SIZE_XLARGE 还是两者都是 XLARGE和 SCREENLAYOUT_SIZE_LARGE。 (注意 XLARGE 是在 Honeycomb 中引入的;您可以在预览版 SDK 中找到该常量。)
如果您想限制哪些设备可以在 Market 上看到您的应用程序,您可以使用supports-screens 标签来指定您兼容的屏幕尺寸。例如,
有关屏幕尺寸的更多信息如下:http://developer.android.com/guide /practices/screens_support.html
If you want to design an app for a tablet, you should be looking at the screen size.
You can find out the screen size with Resources.getConfiguration().screenLayout:
http://developer.android.com/reference/android/content/res/Configuration.html#orientation
Note your first decision there is going to be whether you consider a tablet to be the size SCEENLAYOUT_SIZE_XLARGE or both XLARGE and SCREENLAYOUT_SIZE_LARGE. (Note XLARGE is introduced in Honeycomb; you can find the constant in the preview SDK.)
If you want to limit which devices will see your app on Market, you can use the supports-screens tag to specify which screen sizes you are compatible with. For example
More information on screen sizes is here: http://developer.android.com/guide/practices/screens_support.html