There are times when it is desirable or necessary for your application to know when it is running on a device with DirectStylus support.
It is easy for you to detect this inside of your application. You simply need to query the PackageManager
for a list of available system features and search for the necessary strings.
The following are currently defined features that you can search for:
System Feature | Description |
---|---|
com.nvidia.feature.DirectStylus |
If present, indicates the device supports DirectStylus. For backward compatibility with existing devices, please see com.nvidia.nvsi.feature.DirectStylus below. |
com.nvidia.nvsi.feature.DirectStylus |
If present, indicates the device supports DirectStylus. DEPRECATED: Please check for this feature flag for backward compatibility with existing devices, but also check for com.nvidia.feature.DirectStylus to ensure future compatibility. |
The following is a code sample that shows how to detect if the device supports DirectStylus:
final android.content.pm.PackageManager packageManager = activity.getPackageManager();
final android.content.pm.FeatureInfo[] featuresList = packageManager.getSystemAvailableFeatures();
for (android.content.pm.FeatureInfo f : featuresList)
{
if (f.name != null && (f.name.equals("com.nvidia.feature.DirectStylus") ||
f.name.equals("com.nvidia.nvsi.feature.DirectStylus")) // for backward compatibility
{
// running on device that supports DirectStylus
}
}
NVIDIA® GameWorks™ Documentation Rev. 1.0.220830 ©2014-2022. NVIDIA Corporation and affiliates. All Rights Reserved.