Reputation: 156
One company asked me to make a demo version of their software. After couple hours searching I have come to the conclusion their requirements are not maybe possible.
Problem is capturing microphone in background, even the program is not in use or active. Of course it would be asking of the user permission for that, but is that even possible.
Here is one article: https://www.theverge.com/2018/3/7/17091104/android-p-prevents-apps-using-mic-camera-idle-background
I am not special with Android systems, but is this the end of my project?
The purpose is made this demo with Java. It is "easy" to make an app which is listening microphone and comparing this recorder sound with given sound. In bytes. But in background.. Driving me crazy. Have not found any discussion of this kind of mic using. So thats why i am here guys.
https://developer.android.com/guide/topics/media/mediarecorder
Note: On devices running Android 9 (API level 28) or higher, apps running in the background cannot access the microphone. Therefore, your app should record audio only when it's in the foreground or when you include an instance of MediaRecorder in a foreground service.
If i am understand this right, this kind of app not working on any newer Androids?
Thanks.
Upvotes: 5
Views: 1036
Reputation: 156
On devices running Android 9 (API level 28) or higher, apps running in the background cannot access the microphone. Therefore, your app should record audio only when it's in the foreground or when you include an instance of MediaRecorder in a foreground service.
Upvotes: 4