Question

I am building a webapp, and experimenting with figuring out which capabilities the android device has.

Is there a "capability" or "feature" registry I can look this up in? Take an example: Let's say I need to know whether a device has phone capabilities or perhaps a camera capability. Is there a centralized key store where I can check for these constants?

What I'm trying to create is something to the tune of this:

public String HasCapability(String key) {
    return some.mystical.namespace.Capabilities.ContainsKey(key);
}

I'm kind of new to this (I'm a C# guy), so excuse my syntax.

Was it helpful?

Solution

You can use

PackageManager pm = context.getPackageManager();

if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
}

For more details

Check if device has a camera?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top