You can try:
- SSH to raspberry Pi with given credentials (if both devices are connected to the network... but that may not always be doable)
- Setup web API/app on RPi and use it via browser on Android (like https://github.com/NeonHorizon/berryio )
- Use Bluetooth UART: Adafruit has a full blown Bluetooth UART board, and Chinese make many slave (or master) UART serial boards. This way you could open a serial connection from the phone - and with luck you would get the terminal which by default is cloned to UART in RPi (or it would get your script running on Pi and handling incoming UART messages).