I have the small script below to check if audio is in use on my Android.

if grep -q RUNNING /proc/asound/card*/pcm*/sub*/status; then echo "Playing" ; else echo "Idle"; fi

It works nicely in the console. However, if I execute it in Tasker it always returns "Playing" which means it always evaluates to true.

Anybody an idea why this is happening?

  • Welcome to Android Enthusiasts. I modified the title to make it more general, in case there's alternative to your script. – Andrew T. Feb 18 '16 at 12:19
  • Try this approach in your script and let me know the results: The system service media.player would show you what file(s) is/are being played under Android. Use it as a condition. Access the dump of the system using dumpsys media.player. Surprisingly, when I try your script in my device, it always ends up with "Idle". – Firelord Feb 18 '16 at 14:44
  • I get an unknown error code when i call that in console no matter if root or not. I am on cyanogenmod 13 if this helps. – Claas-Thido Pfaff Feb 18 '16 at 15:08
  • 1
    I'm voting to close this question because OP is running CM13 (CM has not released any stable build of Marshmallow so far) which currently has nightly or experiment builds. As such, this question isn't in consonance with the consensus we've here – Firelord Feb 18 '16 at 15:22
  • But the shellscript works in console. It only goes somehow wrong when run in tasker. And that problem seems to be very similar for other people as well as you wrote. I do not think that this is related to cm13 but rather tasker itself. – Claas-Thido Pfaff Feb 18 '16 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.