FORUMS
Remove All Ads from XDA

[GUIDE][Intermediate] CHANGE MUSIC BY WAVING: Previous & Next song!

580 posts
Thanks Meter: 74
 
By fenchai, Senior Member on 9th March 2016, 03:40 AM
Post Reply Email Thread
22nd September 2017, 08:16 AM |#21  
Junior Member
Thanks Meter: 0
 
More
Would anyone send me this profile and tasks I have tried so many times without success [email protected]
 
 
24th September 2017, 08:46 PM |#22  
Junior Member
Thanks Meter: 0
 
More
Works like a charm, thanks a lot!
2nd October 2017, 06:48 AM |#23  
Junior Member
Thanks Meter: 2
 
More
I have reason to believe that the script would be different for the LG G6.

Despite me following the instructions step-by-step, the script is not working for me at all. However, when I removed the '%SCREEN on the 'Prev and Next track' task, it was working as intended but, of course, I had to keep the screen on.

This might be due to the 'Always On Display' by LG but, when I turned the 'Always On Display' off with the %SCREEN back on the task, it still wouldn't function as intended.

I wonder what's the solution to this?

EDIT:
I found that there's a very narrow window right after I press the lock button where the script detects the command. Very strange.
2nd October 2017, 07:27 PM |#24  
squo_85's Avatar
Senior Member
Thanks Meter: 20
 
More
Very nice way to use it. No more water at screen during shaving and change the music.

Wysłane z mojego ASUS_Z016D przy użyciu Tapatalka
2nd October 2017, 09:37 PM |#25  
squo_85's Avatar
Senior Member
Thanks Meter: 20
 
More
Good Job! Said Hancock
There is one question guys. How to get tasker to know that music e.g. By Poweramp is played during its not at screen and running at background? Is it possible to recognize by staying at notification bar, or music is streaming? I'm asking cause I sometimes play just by the smartphone's speaker...

Wysłane z mojego ASUS_Z016D przy użyciu Tapatalka

---------- Post added at 10:37 PM ---------- Previous post was at 10:01 PM ----------

Ok got one solution. One got called frrancuz helped me at another forum. Do state app select e.g. Poweramp and check only services. The only disadvantage is that you have to leave app by task with killing app in tasker than it disappear from services.

Wysłane z mojego ASUS_Z016D przy użyciu Tapatalka
5th October 2017, 09:13 AM |#26  
Member
Thanks Meter: 14
 
More
Very nice. I expanded it and made it so you can only do this when music is playing (to avoid random "Next"/"Previous" calls when music isn't playing). You can use it if you like.
Instructions:
1. Create task called Is Music Playing (name it however you like, but if you do just remember to use your name instead of "Is Music Playing" in step 2)
- Add a Java function. Class or Object: CONTEXT, Function: getSystemService{Object} (String), Param (String): audio, Return {Object}: manage
- Add a second Java function. Class or Object: manage, Function: isMusicActive {boolean} (), Return {boolean}: %playing
- Add a return action. Value: %playing
TIP: If you can only see "Class or Object" and "Function" in Java Function, the others fields should appear when inputting "Class or Object" and "Function". If the other fields don't appear automatically after inputting Class or Object and Function, exit the action and re-enter it.

2. Edit "Prev/Next Track".
- Add a Perform Task. Name: Is Music Playing, Return Value Variable: %playing. Move it to the top of the task (Make it action #1)
- Add an If statement. %playing ~ true. Move this to the top under "Perform Task" so it's action #2

And that's it! Now it will only trigger if you're playing music.
To the OP: If you include this in the main thread, credit would be nice :P
The Following User Says Thank You to nonamesl For This Useful Post: [ View ] Gift nonamesl Ad-Free
8th October 2017, 06:46 PM |#27  
fenchai's Avatar
OP Senior Member
Thanks Meter: 74
 
More
Quote:
Originally Posted by nonamesl

Very nice. I expanded it and made it so you can only do this when music is playing (to avoid random "Next"/"Previous" calls when music isn't playing). You can use it if you like.
Instructions:
1. Create task called Is Music Playing (name it however you like, but if you do just remember to use your name instead of "Is Music Playing" in step 2)
- Add a Java function. Class or Object: CONTEXT, Function: getSystemService{Object} (String), Param (String): audio, Return {Object}: manage
- Add a second Java function. Class or Object: manage, Function: isMusicActive {boolean} (), Return {boolean}: %playing
- Add a return action. Value: %playing
TIP: If you can only see "Class or Object" and "Function" in Java Function, the others fields should appear when inputting "Class or Object" and "Function". If the other fields don't appear automatically after inputting Class or Object and Function, exit the action and re-enter it.

2. Edit "Prev/Next Track".
- Add a Perform Task. Name: Is Music Playing, Return Value Variable: %playing. Move it to the top of the task (Make it action #1)
- Add an If statement. %playing ~ true. Move this to the top under "Perform Task" so it's action #2

And that's it! Now it will only trigger if you're playing music.
To the OP: If you include this in the main thread, credit would be nice :P

Woa, I didnt know my almost 2 year old post was still active.

Im glad you guys like it.

Btw I had this in mind to give you guys this tutorial as a seed so you guys can turn it into something better.

Things have changed and added some things to it. But the project is the same.

The Java stuff you added to detect if music was playing or not, can be easily made with Autotools. Also, I set it to only activate when on bluetooth or Aux plugged. A scene pops up and asks me if I actually want to play music or play music + gestures.

I think this is only a few ways for you guys to do it but its an idea, and yours is pretty good too.

Have phone customizing!~
The Following User Says Thank You to fenchai For This Useful Post: [ View ] Gift fenchai Ad-Free
31st October 2017, 03:51 PM |#28  
Member
Flag Mumbai, MH
Thanks Meter: 31
 
More
Quote:
Originally Posted by nonamesl

- Add a Java function. Class or Object: CONTEXT, Function: getSystemService{Object} (String), Param (String): audio, Return {Object}: manage
- Add a second Java function. Class or Object: manage, Function: isMusicActive {boolean} (), Return {boolean}: %playing
- Add a return action. Value: %playing
TIP: If you can only see "Class or Object" and "Function" in Java Function, the others fields should appear when inputting "Class or Object" and "Function". If the other fields don't appear automatically after inputting Class or Object and Function, exit the action and re-enter it :P

It won't work till you change "Object" to "AudioManager" in first function.

GetSystemService{AudioManager}(String)

In addition storing result in %PLAYING rather than %playing as former is global and later is native variable for particular task.
Attached project can be imported directly in Tasker (for beginner)
Attached Files
File Type: xml M.prj.xml - [Click for QR Code] (6.4 KB, 90 views)
The Following 2 Users Say Thank You to vipulkarkar For This Useful Post: [ View ] Gift vipulkarkar Ad-Free
13th November 2017, 11:00 AM |#29  
sbetatester's Avatar
Senior Member
Flag Faridabad
Thanks Meter: 86
 
More
Quote:
Originally Posted by vipulkarkar

It won't work till you change "Object" to "AudioManager" in first function.

GetSystemService{AudioManager}(String)

In addition storing result in %PLAYING rather than %playing as former is global and later is native variable for particular task.
Attached project can be imported directly in Tasker (for beginner)

Mine is a bit different from yours and the profile becomes active only when music app is on and remains active while the music is playing in background.
Attaching the project file, so that people don't have to do the hard work.

P.S This is a project file.
To import this file (Manual for Beginners)
1) Go to tasker preferences and disable beginners mode.
2) Then press and hold on home button on the profile screen in tasker and select import.
3) Now locate the file and click on the file.
4) Finally edit your music application in the profile.
Attached Files
File Type: xml Wave_To_Change_Music.prj.xml - [Click for QR Code] (8.8 KB, 172 views)
The Following 3 Users Say Thank You to sbetatester For This Useful Post: [ View ] Gift sbetatester Ad-Free
24th March 2018, 03:23 PM |#30  
Junior Member
Thanks Meter: 0
 
More
Well, when testing here the colors changes affected by proximity, but it doesnt change music on spotify with the screen off.
Guess I made something wrong on this task. Could you give more details, prints on the actions edit?

---------- Post added at 03:23 PM ---------- Previous post was at 03:18 PM ----------

Quote:
Originally Posted by fenchai

Before trying this you need to know the basics of using Tasker, the switcher needs to be "ON" on all 3 profiles.

If by Active you mean the green color, it changes from Prox 0 to Prox 1 depending on your proximity sensor. That is supposed to happen.

To try this, just switch all 3 profiles to ON and turn off your screen have music playing, and move your hand to the proximity sensor.

24th September 2018, 02:18 PM |#31  
Member
Thanks Meter: 7
 
More
Okay, everything works brilliantly, except i cant get it to work with the screen off
Ive tried to do a bunch of things to keep the proximity sensor on while the screen is off but its not working, anybody have a solution?
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes