Feature for getSystemAvailableFeatures() and hasSystemFeature(String).
The device supports app widgets.
Constant Value: "android.software.app_widgets"
1. Get a PackageManager Instance named myPackageManager.
Constant Value: "android.software.app_widgets"
1. Get a PackageManager Instance named myPackageManager.
2. Create a Boolean Variable named bolWidgetSupported.
3. Set the Minimum and Target SDK version to 18 or greater.
4. In the onCreate method, add the below code. This will return the app widget support to a boolean named bolWidgetSupported. It will then display a toast displaying the app widget support ability of the device to the user.
bolWidgetSupported = myPackageManager.hasSystemFeature(PackageManager.FEATURE_APP_WIDGETS);
if (bolWidgetSupported) {
Toast.makeText(this, "Device supports App Widgets", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "Device does NOT support App Widgets!", Toast.LENGTH_LONG).show();
}
5. Compile and run!
Resources:
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_APP_WIDGETS
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_APP_WIDGETS