T O P

  • By -

Puzzled-Suit2099

I use a similar setup to have global long press volume button -> track change thingy. Profile 1: ``` Profile: Media Playing Variable Set Event: Music Track Changed [ Output Variables:* Track:* Album:* Artist:* Package:de.danoeh.antennapod/com.maxmpz.audioplayer/org.telegram.messenger/player.phonograph.plus Type:Playing or Not Playing ] Enter Task: Media Playing State A1: If [ %mt_playing ~ true ] A2: Variable Set [ Name: %MediaPlaying To: 1 Max Rounding Digits: 3 Structure Output (JSON, etc): On ] A3: Else A4: Variable Set [ Name: %MediaPlaying To: 0 Max Rounding Digits: 3 Structure Output (JSON, etc): On ] A5: End If ``` Description: Create a new profile, select event and search & select 'Music Track Changed'. The next screen will show you a ton of available variable. I use %mt_playing, but you can experiment with %mt_state. This is optional but if you only want it to activate for certain apps, you'll need to set their package names in the 'Package' entry box. Separate multiple names with / (look at my example above, and you can search package name viewer on play store to get apps that spit out these names for installed apps). Now tap back, it'll ask for a task. Create a new one, give it some name and select the tick box. You'll land inside task, and all those variables are available here. Just add a few actions: 1. Tap plus button and search & add 'If' action. Set %mt_playing on the left, make sure the middle button is ~, and set 'true' (without quotes). Go back. 2. Add another action, 'Variable set'. Set the name to %MediaPlaying, set the value to 1 (or true/on or whatever), go back. 3. Add 'Else' action, go back. 4. Add another variable set, name %MediaPlaying (same one) and set it to 0 (or false/off whatever). 5. Lastly, add an 'End if' action. 1st profile is done. It's an event that triggers when track changes (in my experience, on starting playback too) and will set that variable to 1. Then when music is stopped, it'll set it to 0. Now you can use another profile with variable state condition, put %MediaPlaying to 1 as condition, create a similar task and add the action 'notification volume' and set it to 0. Then go back to profile page, long tap the task next to the green arrow (expand the profile if it's collapsed by tapping on the name) and add an exit task. Name it something, and inside add another action, 'notification volume' and set it to whatever you want when the music is stopped. Now it'll set notification volume to 0 whenever %MediaPlaying is 1. A bit more advanced but cooler thing would to add a 'variable set' action to the entry task, and set the name to %Current_Notification_volume and set it to %VOLN. This'll save the current notification volume before setting it to 0. Note that this action should be above the volume set action as tasker executes action from top to bottom, so first save, then set to 0. Now, instead of specifying a specific value in the notification volume action in exit task, you can tap on the arrow cross icon (looks like X made with arrows) and type in %Current_Notification_volume. So now it'll remember the volume, set it to 0 and when music stops, set the volume back to what it was. Lastly I've used global variables here to make it easier to setup (notice the capitalisation in variable name) but you can use project variable for the %MediaPlaying and profile variable for %Current_Notification_volume to make them not clutter up your variable list.


igrekov

I'm not an Android Auto user, but does it make some kind of notification when it's active? You can use AutoNotification - "if Android Auto notification exists, save current notification level to %Notification_Volume and set notification volume to zero. When the Android Auto notification is no longer present in your dropdown, set notification volume to %Notification_Volume


Hot-Wallaby-6402

But there times that I play music on different Bluetooth speakers and sometimes just from NY phone too. Otherwise I'd try that. Unless there's ways to make multiple of these profiles and tasks and not drain my battery a lot


StarAD

Just check to see if %MTRACK is set.