[Android Head-Units] edit:
I'm in a desperate need for help with the launch.sh.

I've stayed till 6 am struggling with the Waze power issues and trying to figure out how to modify the launch.sh. NO luck.

I'm clueless about scripting and programming so figuring out launch.sh is hard.

All I want to do is:

1. from my steering wheel M button to flip through apps without touching the HU .... at first between Deezer and Xiialive to be able to learn the mechanism.

2. I want to use the HU buttons, Radio, Media, DVD to launch my installed apps like Deezer, XiiaLive, PlayerPro... and maybe use the Eject button for Waze

3. Maybe, if it's possible by pressing 1 button multiple times to launch different apps... but that's optional... seems complicated.

This is my script and of course it does not work

1. It does not start any apps on buttons presses

2. the Radio, Media, DVD buttons don't do anything while pressed, aren't even assigned to the old apps

# My first failed attempt
#

# Goto Home screen
home="input keyevent 3"

# Back
back="input keyevent 4"

# pause
pause="input keyevent 127"

# Play
play="input keyevent 126"

# Recent Task list
recent="input keyevent KEYCODE_APP_SWITCH"

# ScreenFilter
scrflt="am start com.haxor/com.haxor.ScreenFilter"

# Google Voice Command
gvc="am start com.google.android.googlequicksearchbox/com.google.android.googlequicksearchbox.VoiceSearchActivity"

# Google maps
maps="am start com.google.android.apps.maps/com.google.android.maps.MapsActivity"

# XiiaLive
xiialive="am start com.android.DroidLivePlayer/com.vblast.xiialive.ActivityMain"
xiialive=$play

# Deezer
deezer="am start deezer.android.app/com.deezer.feature.home.TabBarActivity"
deezer=$play

# PlayerPro
playerpro="am start com.tbig.playerpro/.MediaPlaybackActivity"
playerpro=$play

# Torque
torque="am start org.prowl.torque/org.prowl.torque.landing.FrontPage"

# key is the only arguemnt recieved and actions are based on the key number
key=$1

case $key in

37) # SOURCE/MODE
#
# Toggle between applications Deezer and XiiaLive
# If longer than 1m, then bring up the last one
# called before continuing cycle
# I can't test it untill I install the unit in the car

# Check if key press in last minute by checking if key file was modified
found=`busybox find /data/$key.cnt -mmin -1 | wc -l`
if [ "$found" = "0" ]
then
# More than 1 minute bring current player to front
next=`cat /data/$key.last`
# Do not send pause or play
keypress=0
else
next=`cat /data/$key.cnt`
keypress=1
# Send pause before changing to next
$pause
fi
echo $next > /data/$key.last

case $next in
0) echo 1 > /data/$key.cnt
$deezer
( [ $keypress = 1 ] && sleep 3 && $deezer_press)
;;
1) echo 2 > /data/$key.cnt
$xiialive
( [ $keypress = 1 ] && sleep 3 && $xiialive_press)
;;
*) echo 0 > /data/$key.cnt
echo 0 > /data/$key.last
$home
;;
esac
;;

31) # DVD - trying to start PlayerPro with NO luck
$playerpro
;;
32) # EJECT - Would be nice to use it for Waze
;;

33) # MEDIA KEY - I want to start Deezer app but it does not work
$deezer
;;
34) # BAND KEY - On my button says RADIO, don't know if they use the same code, I want to start Xiialive but it does not work either
$xiialive
;;

89) # FB
;;
97) # ACC_ON - execute on key on
$play
;;
98) # ACC_OFF - executes on key off
$pause
sleep 5
am force-stop com.waze
;;
99) # RESUME - executes on resume of system
# Commands to be executed on resume

;;

*) # Pass any other keys pressed as keyevent
# 3-Home, 4-Back, 85-PlayPause, 88-Prev, 86-Stop, 89-FB
# 90-FF, 87-Next, 126-Play, 127-Pause
input keyevent $key
;;
esac # End $key cases

exit 0