我开发一个应用程序,它列出了所有的硬件功能,如WiFi,蓝牙,NFC等..
我使用PackageManager.hasSystemFeature()
检查。
同样反正是有检查Android设备是否具有SPEN硬件支持与否?
我需要progrmmatically检查。
我敢肯定,这是包括在开发人员指南http://developer.samsung.com/:
boolean isSpenFeatureEnabled = false;
Spen spenPackage = new Spen();
try {
spenPackage.initialize(this);
isSpenFeatureEnabled = spenPackage.isFeatureEnabled(Spen.DEVICE_PEN);
} catch (SsdkUnsupportedException e) {
Toast.makeText(this, "This device does not support Spen.", Toast.LENGTH_SHORT).show();
e.printStackTrace();
finish();
} catch (Exception e1) {
Toast.makeText(this, "Cannot initialize Pen.", Toast.LENGTH_SHORT).show();
e1.printStackTrace();
finish();
}
请注意,三星SPEN SDK并不只支持SPEN硬件。
例如,如果你尝试spenPackage.initialize()
的老三星型号S6一样没有实体SPEN,初始化()过程也将是成功的,您将能够利用与手指触摸SPEN SDK。