Help with random music please.

brett

New member
Hello,
I am new to macrodroid and am struggling to use it, but I want to very much. Does anybody know how I can get macrodroid to automatically play a randomly selected song from one of the files I have on my phone ?

Many Thanks.
 

Jacob L

Moderator
Hello,
I am new to macrodroid and am struggling to use it, but I want to very much. Does anybody know how I can get macrodroid to automatically play a randomly selected song from one of the files I have on my phone ?

Many Thanks.
Yes. We need to use send intents. I'm currently working on this macro.
 

MacroDroidDev

Administrator
Staff member
If you are happy to just have a small subset of files (e.g. 10). You could do something like

Trigger
<Whatever you want>

Actions
Set integer variable to random value between 0-9

If (integer variable = 0)
play song a
else if (integer variable = 1)
play song b
else if.....
 

Doremi

New member
The code that was shown is clearly not suitable for such applications. Well, if you have 5-10 tracks in your playlist, but what if you listen to some very popular artist, for example, Travis Scott net worth reaches 66 million and there are about 100 tracks of him? Are you going to write else if 100 times? To do this, there are special functions of random type, which is called at the end of the stream track, or you can write at least a simple loop, instead of using the if-else construct. This is a fairly simple task, you can also call random when you click on a certain button, for example.
 
Top