开发者

Android HTC Hero not reporting back correct FeatureInfo

I'm having a strange problem with my HTC Hero 2.1

model=HERO200

manufacturer=HTC

APILevel=7

It is not reporting back that it has a hardware microphone. Here is my code to check for Features.

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Context context = this;
    PackageManager pm = context.getPackageManager();
    FeatureInfo[] foo = pm.getSystemAvailableFeatures();
    for (FeatureInfo bar : foo) {
        if (bar.name != null) {
            System.out.println(bar.toString());
            if (bar.name.equalsIgnoreCase("android.hardware.microphone"))
               开发者_开发技巧 System.out.println("Booyah!");
        }
    }
}

It does report back these features:

android.hardware.camera

android.hardware.wifi

android.hardware.location.network

android.hardware.bluetooth

android.hardware.sensor.light

android.hardware.location

android.hardware.location.gps

android.hardware.camera.autofocus

android.hardware.touchscreen.multitouch

android.hardware.touchscreen

android.hardware.sensor.accelerometer

android.hardware.sensor.compass

Some are API Level 8 like compass and gps, and others are level 7. Is there another way I can search for features? Something else I can use besides getSystemAvailableFeatures()? Maybe a lower level system call? Why is my phone not reporting back that it has a hardware microphone? Help please :) Thanks!


I guess if this phone is set for Android API Level 7... then I just can't set a requirement that was designed for API Level 8 (Like microphone).

This is the proper way to request features of the phone from Android.

So... this sucks... oh well. But still weird that this phone does report back some features from API Level 8, but you shouldn't rely upon that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜