App Inventor Extensions


Audio Capture Extension

See the App Inventor Extensions document about how to use an App Inventor Extension.

For questions about this extension or bug reports please start a new thread in the App Inventor community. Thank you.

For feature requests please contact me by email. To be a sponsor of a new method already is possible starting from only 10 USD! With your contribution you will help the complete App Inventor community. Thank you.

Nov 26th, 2020: Version 1: initial version for App Inventor.

Jan 2nd, 2021: Version 2: The complete functionality (Start Recording, Stop Recording, Shutdown Service) can now be triggered from the notification. Also the notification is fully customizable (small Icon, notification title, notification text and the three 3 button texts for Record, Stop and Shutdown)

Description

Audio Capture Extension to capture the audio of other applications (usage type MEDIA, GAME and UNKNOWN) using the new Audio Playback Capture API in Android 10, see also this Google blog.
Minimum API level is 29 (Android 10).
Required permissions: android.permission.RECORD_AUDIO, android.permission.FOREGROUND_SERVICE

Starting with Kodular Fenix 1.5.3 this extension now also should work in Kodular..

Note: This extension currently does not work on Android 13 devices. I'm investigating the issue..

What is possible and what not?

It is possible to capture for example the audio of a Youtube video, a Whatsapp audio message, some music played by VLC Player, etc., it is not possible to capture the audio of a phone call.

What does the user see?

In order to capture the audio of other apps the user must grant the record audio permission to the app doing the capturing.

Additionally, before a capture session can be started the capturing app will display the following "ugly" dialog to the user

The user must tap "Start now" in order for a capturing session to be started. A permanent notification will be displayed in the status bar for the user to start recording, stop recording or shutdown the service.

Note: Do not use the close application block together with this extension. The code behind the close application block terminates the app in an ungraceful way and unfortunately also kills the running audio capture process. Please use the MoveTaskToBack method instead .

How does it work?

  1. Start your Audio Capturing app, agree to the "ugly" dialog message, start the service and move the Audio Capturing app to the back.
  2. Now start the app you like to capture the audio.
  3. From the Audio Capture notification start the recording and later stop the recording or shutdown the service.
  4. The captured audo file will be stored in the ASD (Application Specific Directory) in wav format.

Properties


Return Filename for recording.


Set Filename for recording (wav format). The file will be stored in the ASD - Application Specfic Directory, which is /storage/emulated/0/Android/data/<packageName>/files. Default filename is TaifunAudioCapture.wav.


Return Sound (true or false).


Whether Sound should be on (true) or off (false). Default value is true. If set to true, a short beep sound will be played before and after recording.


Return SmallIcon.


Set SmallIcon for notification. Recommended size is 96x96.


Return Title.


Set Title to be displayed in the notification. Default value is "Audio Capture".


Return Text.


Set Text to be displayed in the notification. Default value is "Audio Capture Service is running...".


Return Record Button text.


Set Text to be displayed in the record button of the notifier. Default value is 'Record'.


Return Stop Button text.


Text to be displayed in the stop button of the notifier. Default value is 'Stop'.


Return Shutdown Button text.


Text to be displayed in the shutdown button of the notifier. Default value is 'Shutdown'.

Methods


Start Service
Note: You will have to build the app to be able to test.


Stop Recording
Note: You will have to build the app to be able to test.


Shutdown Service
Note: You will have to build the app to be able to test.


Move task (i.e. the app) to the background.


Get complete path to the last recorded audio in the ASD - Application Specfic Directory.

Events


Event indicating if media projection permission has been obtained or not.

Example App Audio Capture Test


Screenshots





There is not much to see in the example app itself, because the main functionality will be triggered in the notification.

Test

Tested successfully on Samsung Galaxy A51 running Android 10.

Questions and Answers

currently none

For questions about App Inventor,
please ask in the App Inventor community.Thank you.

Test the functionality of the Audio Capture extension

  1. Follow the opt-in URL for the audio capture example app to get access to the app and to be able to download it to your device.
  2. Start testing.

Buy the Audio Capture extension for App Inventor


You can buy this extension (aix file).
With your payment you accept the terms and conditions below.

Payment options

1. Paypal

Please transfer 12 USD via Paypal
to Pura Vida Apps

2. Bitcoin

After having received your payment I will be happy to send the download link to you. Please let me know your Google account! I usually will send the download link not later than 24 hours after having received your payment.
Thank you! Taifun


Terms and Conditions

Back to top of page ...


Home | Snippets | Tutorials | Extensions | Links | Search | Privacy Policy | Contact