Skip to content

Instantly share code, notes, and snippets.

@ericosur
Last active April 9, 2021 06:27
Show Gist options
  • Save ericosur/f2aa1515ce69d4537c165cc04a90c149 to your computer and use it in GitHub Desktop.
Save ericosur/f2aa1515ce69d4537c165cc04a90c149 to your computer and use it in GitHub Desktop.
query system features from package manager
import android.content.pm.PackageManager;
import android.content.pm.FeatureInfo;
import android.util.Log;
// $ adb shell pm list features
private void querySystemFeatures() {
static final String APP_TAG = "app_tag";
final PackageManager pm = getPackageManager();
final FeatureInfo[] featuresList = pm.getSystemAvailableFeatures();
String feature_string = "";
for (FeatureInfo f : featuresList) {
if (f.name != null) {
feature_string += f.name + "\n";
}
}
feature_string += "\n";
Log.i(APP_TAG, "rasmus: query features: " + feature_string);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment