So, in the first recipe, we detected whether another app is installed on the simulator/device. Now, we can do something with this information and launch another app.
Go back to the app.js
file in Studio. Let's replace the checking code with an updated version that adds some event listeners to the labels:
if (Ti.Platform.canOpenURL("maps:")) { label1.text = label1.text + " Installed"; label1.addEventListener("click", function() { Ti.Platform.openURL("maps:"); }); } else { label1.text = label1.text + " Not installed"; } if (Ti.Platform.canOpenURL("tweetbot:")) { label2.text = label2.text + " Installed"; label2.addEventListener("click", function() { Ti.Platform.openURL("tweetbot:"); }); } else { label2.text = label2.text + " Not installed"; }
Save and relaunch the app. This time, if you click on the labels that say Installed, the apps will open!