Open taimoor522 opened 2 years ago
It seems this is more an issue with the flutter foreground service than this plugin. Please bring the issue up with the author of that plugin.
otherwise, you can look at his example on how to implement the foreground service with tflite_audio here: https://github.com/Dev-hwang/tflite_audio_example
E/AndroidRuntime(10013): Process: com.example.flutter_application_test, PID: 10013 E/AndroidRuntime(10013): java.lang.IllegalStateException: startRecording() called on an uninitialized AudioRecord. E/AndroidRuntime(10013): at android.media.AudioRecord.startRecording(AudioRecord.java:1147) E/AndroidRuntime(10013): at flutter.tflite_audio.Recording.start(Recording.java:91) E/AndroidRuntime(10013): at flutter.tflite_audio.TfliteAudioPlugin.record(TfliteAudioPlugin.java:592) E/AndroidRuntime(10013): at flutter.tflite_audio.TfliteAudioPlugin.lambda$GvBCQqT11rP0XXTQzopagqcPxcA(Unknown Source:0) E/AndroidRuntime(10013): at flutter.tflite_audio.-$$Lambda$TfliteAudioPlugin$GvBCQqT11rP0XXTQzopagqcPxcA.run(Unknown Source:2) E/AndroidRuntime(10013): at java.lang.Thread.run(Thread.java:923) I/ExceptionHandle(10013): at android.media.AudioRecord.startRecording(AudioRecord.java:1147) I/ExceptionHandle(10013): at flutter.tflite_audio.Recording.start(Recording.java:91) I/ExceptionHandle(10013): at flutter.tflite_audio.TfliteAudioPlugin.record(TfliteAudioPlugin.java:592) I/ExceptionHandle(10013): at flutter.tflite_audio.TfliteAudioPlugin.lambda$GvBCQqT11rP0XXTQzopagqcPxcA(Unknown Source:0) I/ExceptionHandle(10013): at flutter.tflite_audio.-$$Lambda$TfliteAudioPlugin$GvBCQqT11rP0XXTQzopagqcPxcA.run(Unknown Source:2) I/ExceptionHandle(10013): at java.lang.Thread.run(Thread.java:923) D/TfliteAudio(10013): Parameters: {detectionThreshold=0.3, minimumTimeBetweenSamples=0, method=setAudioRecognitionStream, numOfInferences=1, averageWindowDuration=0, audioLength=0, sampleRate=44100, suppressionTime=0, bufferSize=11016} D/TfliteAudio(10013): AudioLength has been readjusted. Length: 44032 D/TfliteAudio(10013): Transpose Audio: false D/TfliteAudio(10013): Check for permission. Request code: 13 D/TfliteAudio(10013): Permission already granted.