伙计们,
我们的应用程序仅适用于具有特定序列号的特定型号的显示器。在我们的应用程序的 Linux 版本上,我们通过 EDID 获取此信息。
我们现在正在考虑将代码移植到 Android (Google TV)。
Android NDK 上是否有任何 API 可以让我们获取显示设备特征,例如其型号和序列号?
预先感谢您的帮助。
问候,
彼得
由于 Google TV 设备没有电话硬件,因此您无法使用 TelephonyManager 获取设备 ID。
您可以使用以下代码获取其他设备信息:
Log.i(LOG_TAG, "android.os.Build.VERSION.RELEASE="+android.os.Build.VERSION.RELEASE);
Log.i(LOG_TAG, "android.os.Build.VERSION.INCREMENTAL="+android.os.Build.VERSION.INCREMENTAL);
Log.i(LOG_TAG, "android.os.Build.DEVICE="+android.os.Build.DEVICE);
Log.i(LOG_TAG, "android.os.Build.MODEL="+android.os.Build.MODEL);
Log.i(LOG_TAG, "android.os.Build.PRODUCT="+android.os.Build.PRODUCT);
Log.i(LOG_TAG, "android.os.Build.MANUFACTURER="+android.os.Build.MANUFACTURER);
Log.i(LOG_TAG, "android.os.Build.BRAND="+android.os.Build.BRAND);
对于 Vizio Co-Star Google TV 设备,您将获得以下信息:
android.os.Build.VERSION.RELEASE=3.2
android.os.Build.VERSION.INCREMENTAL=U4.6.0-ota2
android.os.Build.DEVICE=VAP430
android.os.Build.MODEL=VAP430
android.os.Build.PRODUCT=StreamPlayer
android.os.Build.MANUFACTURER=VIZIO
android.os.Build.BRAND=Vizio
您可以使用以下命令转储所有功能:
TextView text = (TextView) findViewById(id.featurestextview);
FeatureInfo features[] = getPackageManager()
.getSystemAvailableFeatures();
Log.d("Features", "getSystemAvailableFeatures() = " + features);
text.append("Supported System Features on this device:\n\n");
if (features != null) {
for (FeatureInfo featureInfo : features) {
if (featureInfo.name!= null) {
text.append(featureInfo.name+" (Flags: "+featureInfo.flags+") \n");
} else {
text.append(featureInfo+"\n");
}
}
}
long maxMemory = Runtime.getRuntime().maxMemory();
int memoryClass = ((ActivityManager) getSystemService(ACTIVITY_SERVICE)).getMemoryClass();
MemoryInfo memInfo = new MemoryInfo();
((ActivityManager) getSystemService(ACTIVITY_SERVICE)).getMemoryInfo(memInfo);
text.append("\n\nMEMORY:\nMaxMemory "+maxMemory/1024+"KB / "+maxMemory/1024/1024+"MB");
text.append(" (Memory Class: "+memoryClass+")");
text.append("\n MemoryInfo: Avail="+ memInfo.availMem / 1024 +"KB Threshold="+memInfo.threshold /1024 +"KB");
供应商等的 android 构建属性将允许您将范围限定到特定设备。关于序列号(例如,cpu 序列号 - 不可用),我们建议您使用 mac 地址。