Android 应用程序有什么方法可以知道它安装在哪个设备上吗?

发布于 2024-10-14 15:11:23 字数 290 浏览 2 评论 0原文

假设我想针对特定的几个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心如狂蝶 2024-10-21 15:11:23

尝试...

String s="Debug-infos:";
s += "\n OS Version: " + System.getProperty("os.version") + "(" + android.os.Build.VERSION.INCREMENTAL + ")";
s += "\n OS API Level: " + android.os.Build.VERSION.SDK;
s += "\n Device: " + android.os.Build.DEVICE;
s += "\n Model (and Product): " + android.os.Build.MODEL + " ("+ android.os.Build.PRODUCT + ")";

Try...

String s="Debug-infos:";
s += "\n OS Version: " + System.getProperty("os.version") + "(" + android.os.Build.VERSION.INCREMENTAL + ")";
s += "\n OS API Level: " + android.os.Build.VERSION.SDK;
s += "\n Device: " + android.os.Build.DEVICE;
s += "\n Model (and Product): " + android.os.Build.MODEL + " ("+ android.os.Build.PRODUCT + ")";
酒与心事 2024-10-21 15:11:23

如果您想为平板电脑设计应用程序,您应该考虑屏幕尺寸。

您可以使用 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 标签来指定您兼容的屏幕尺寸。例如,

<supports-screens android:smallScreens="false" android:normalScreens="false" />

有关屏幕尺寸的更多信息如下: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

<supports-screens android:smallScreens="false" android:normalScreens="false" />

More information on screen sizes is here: http://developer.android.com/guide/practices/screens_support.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文