How to detect if a microphone is present in android?

前端 未结 2 980
情书的邮戳
情书的邮戳 2021-01-12 05:30

I have a voice recognition part in my application to capture users voice input.

This is what I do

Intent voiceIntent = new Intent(RecognizerIntent.AC         


        
2条回答
  •  孤街浪徒
    2021-01-12 05:52

    PackageManager pm = getPackageManager();
    boolean micPresent = pm.hasSystemFeature(PackageManager.FEATURE_MICROPHONE);
    

    Android API Reference: hasSystemFeature

提交回复
热议问题