Choice of Music Players when headphones are plugged in
Posted: 09 May 2013 15:09
Hey Guys,
Automagic is awesome first of all. I'm a couple days in and enjoying it. I'm trying to perform some actions when my headphones are in:
1. Change volume to 7.
2. Present an input dialog menu with a single choice menu of either Pandora or Spotify. Once I figure out how to get it working I'll add two more choices Songza and the native music player app.
3. Script which determines which option was chosen.
4. Launch an app based on the user's choice.
My problem is figuring out which variable to use to perform the check so that I can launch the right app. I'm not sure which variable to use or whether i need to check for a number or the actual string that I put as choices for the input dialog. My script looks like this
if (value = "Pandora")
{
pack = "com.pandora.android";
activity = "com.pandora.android.Main";
}
else
{
pack = "com.spotify.mobile.android.ui";
activity = "com.spoitify.mobile.android.ui.activity";
}
When it comes to launching the app I have {pack} in the package line and {activity} in the class name line.
My log file says "unable to find explicit activity class"
I'm pretty sure the error is in my if statement condition so {pack} and {activity} never get assigned.
Can someone help me figure out in situations like that how to tackle the variable from input dialog. It'll help me out going forward.
Thanks!!!!
Automagic is awesome first of all. I'm a couple days in and enjoying it. I'm trying to perform some actions when my headphones are in:
1. Change volume to 7.
2. Present an input dialog menu with a single choice menu of either Pandora or Spotify. Once I figure out how to get it working I'll add two more choices Songza and the native music player app.
3. Script which determines which option was chosen.
4. Launch an app based on the user's choice.
My problem is figuring out which variable to use to perform the check so that I can launch the right app. I'm not sure which variable to use or whether i need to check for a number or the actual string that I put as choices for the input dialog. My script looks like this
if (value = "Pandora")
{
pack = "com.pandora.android";
activity = "com.pandora.android.Main";
}
else
{
pack = "com.spotify.mobile.android.ui";
activity = "com.spoitify.mobile.android.ui.activity";
}
When it comes to launching the app I have {pack} in the package line and {activity} in the class name line.
My log file says "unable to find explicit activity class"
I'm pretty sure the error is in my if statement condition so {pack} and {activity} never get assigned.
Can someone help me figure out in situations like that how to tackle the variable from input dialog. It'll help me out going forward.
Thanks!!!!