Terminal Titanium: Get Notified

I thought I would kick off a series on tips, trick and speed ups for those using titanium from the terminal. I use vim/tmux for all my tidev, but none of these posts will assume you do the same. If you are reading this I am going to assume that you are already pretty familiar with the titanium cli.

Distribution builds can, understandably, take some time. You will probably turn your attention to other things while you wait. It is really handy to get a notification when the build is complete. I’m going to show how one OS X.

terminal-notifier

terminal-notifier “is a command-line tool to send Mac OS X User Notifications, which are available in Mac OS X 10.8 and higher.” If you have brew installed you can install it like this:

$ brew install terminal-notifier

Have a look at the link above to understand all the options available.

Get notified

The simplest way to get notified after a build is, e.g. as follows:

$ titanium build -p android -T device -b && terminal-notifier -sound default -message "Android Build Complete"

Or if you head to the kitchen you can be notified by email:

$ titanium build -p android -T device -b && (echo "Get back to work" | mail -s "Android Build Done" me@myemail.com)

If you have already kicked off the long process and still want to be notified, first press ctrl-z to put the process in the background and then type:

wait %1 ; terminal-notifier -sound default -message "Android Build Complete"

Credits to @climagic for the last technique.

David Bankier leads YY Digital, a company that builds integrated mobile, tablet and server side applications for enterprise. He has used Titanium for mobile dev since 2010 and uses a mix of Node and Scala on the backend. TCE, Titan, OSS dev and he likes to CodeFast