VolumeEvents: Listen to volume change events

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.

@vknow360 awesome extension... but Can we have blocks like:

When_Headphone_VolumeUp.Clicked -> do :
Something...

1 Like

Sure, you can sponser the new features.

2 Likes

How come that??..

Hi vknow360,
thank your for extension.
In my AI2 project, I use the "call VolumeEvents1.getVolume" of stream3, but I keep receiving the error "Attempt to invoke virtual method 'int com.sunny.VolumeEvents.VolumeObserver.getValue(int)' on a null object reference".
Any idea?
I understood "3" is for the Music stream, but it makes no difference whether I play music on the device or not. In both cases, I receive this error.
KR, Oli

I think it will not work in companion and will work in the created app
because the screen recorder extension has the same issue in the companion

yes, I did complie the APK and install. I never work with Companion.

Please pm me the apk link.
Or, if possible, post here the logcat.

Hi vknow360,

here i loop over all 8 streams, fetching the volume, while i played music on my smartphone, so I was assuming, stream 3 would write a volume level into my log.
Below the loop, I said, if sztream 3 volume level is GT 10 (meaning, if sound is on anyway), i would like to have spoken output.

This all would just be a work-around: What I wanted to check originally: Whether the user has its smartphone to "silent mopde" (or "vibration only" mode). If so, do not give spoken output. But to check that seems to be quite impossible, I understood.

KR, Oli

Um....

Did you start the listener before executing the block? That's necessary.

1 Like

Gonna try it.

Hello. your plugin is spectacular, but I have a problem, the volume change is received even without any actual changes. I tried to put both value 3 and value 1 on streamType but the result doesn't change. The action triggered by the .volumeChanged trigger is performed randomly. can you help me?

I add that it detects a lot of volume changes when I press the key to open recent apps on Android (the last key on the right)

Can you please elaborate this a little more?
Also post the aia.

P.S. a different logic solved the issue.
com.sunny.VolumeEvents.aix (8.4 KB)
(this is not an update)

It does not work

How can you read a switch with headphone TRRS cable (speedometer)?

Hi!
I would like a simple and straightforward solution to read a switch state with my Android app.
The use case is the following: to measure speed on my bike I would need to store the timestamp each time the switch is close (the magnet on the spoke goes in front of the sensor).
I don't want any arduino in between with OTG cable, or serial over USB.

I've found the great "Listen to volume change events" extension developed by Sunny Gupta. It's responsive (under 100 ms) but after ten clicks (volume down) it's the minimum level and the volume.change event isn't triggered anymore.
I wish I could reset the volume to max after each change "volume down" but the extension doesn't allow this.
Is there some other ideas, please?
Thanks

image

image

So you want to set volume level to max yourself?

1 Like

Yes, that could be a way to trigger infinitely the volume.change events.
Each time volume is down, I'll set it back to max. :blush:

Is it a possible way? :slightly_smiling_face: or should I find another workaround?

Possible, it is just that I couldn't find time for this. I am good at forgetting things.

1 Like