VolumeEvents: Listen to volume change events

1.Introduction

Description: With this extension you can listen to volume change events and get volume values of different stream types
Latest Version: 1
Released: 2021-03-03T18:30:00Z
Last Updated: 2021-03-03T18:30:00Z

2.Blocks

image

3.Documentation

  • Volume Changed
    Event triggered when volume changes
    image
    previousVolume ~ int
    currentVolume ~ int
  • Get Max Volume
    Returns max volume value of given stream type
    image
    Accepts int
    Returns : int
  • Get Min Volume
    Returns min volume value of given stream type
    image
    Accepts int
    Returns : int
  • Get Volume
    Returns current volume value of given stream type
    image
    Accepts int
    Returns : int
  • Start Listening
    Starts listening to volume changes
    image
  • Stop Listening
    Stops listening to volume changes
    image
  • Stream Type
    Sets audio stream type i.e. which stream volume changes should listener listen to
    image
    Accepts int
    Default Value : 3

Stream Values
VOICE_CALL -> 0
SYSTEM -> 1
RING -> 2
NOTIFICATION -> 5
MUSIC -> 3
DTMF -> 8
ALARM -> 4

4.Download

Download Link: com.sunny.VolumeEvents.aix (8.4 KB)

Inspired from here: https://community.kodular.io/t/extension-request-detect-volume-buttons-events/109712

Hope it helps! :slightly_smiling_face:

12 Likes

Wow, you are incredible @vknow360 :star_struck: :+1:
Good Job :heart_eyes: :+1:

great work!

Great work!

You are amazing, great extension :exploding_head:

1 Like

Hi Sunny

A Challenge: Can you add the ability to disable and enable the physical volume buttons?

... and on the subject of button re-mapping, enabling/disabling of the power button too?

Just for volume buttons, when it change set back the old value :thinking:

It is not possible as far as I know.
Some changes are needed in Form.java file to implement those methods.

Maybe try to create extended form if possible with you're extension?

There are Apps that can do it........ bear in mind that it is temporary, when the App is Active.

I meant to say it is not possible with extension.
Obviously it is possible with code in android where you extend Activity but in extension you extend AndroidNonvisibleComponent and Form implements only few methods of Activity.

That is not possible.

I see - that also to a certain extent explains why there are few essential extensions amongst a sea of trivial ones. :thinking:

Our work around then could be to create an App (Android Studio Kotlin) specifically for the task and run that App from the main App (App Inventor).

Yes that is the main reason.
It can be solved if some basic changes are made in Form.java file but merging of those changes in ai2 may take some time.