File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
firebase-ai/src/main/kotlin/com/google/firebase/ai/type Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import android.content.Context
2222import android.content.pm.PackageManager
2323import android.media.AudioFormat
2424import android.media.AudioTrack
25+ import android.os.Build
2526import android.util.Log
2627import androidx.annotation.RequiresPermission
2728import com.google.firebase.ai.common.JSON
@@ -98,11 +99,13 @@ internal constructor(
9899 public suspend fun startAudioConversation (
99100 functionCallHandler : ((FunctionCallPart ) -> FunctionResponsePart )? = null
100101 ) {
101- if (
102- context.checkSelfPermission(Manifest .permission.RECORD_AUDIO ) !=
103- PackageManager .PERMISSION_GRANTED
104- ) {
105- throw PermissionMissingException (" Missing RECORD_AUDIO" )
102+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .M ) {
103+ if (
104+ context.checkSelfPermission(Manifest .permission.RECORD_AUDIO ) !=
105+ PackageManager .PERMISSION_GRANTED
106+ ) {
107+ throw PermissionMissingException (" Missing RECORD_AUDIO" )
108+ }
106109 }
107110
108111 FirebaseAIException .catchAsync {
You can’t perform that action at this time.
0 commit comments