Skip to content

Instantly share code, notes, and snippets.

@MotiurRahman
Forked from csemrm/app.js
Created March 31, 2017 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MotiurRahman/2d2c0579e497bee91cc912e6cc96a57e to your computer and use it in GitHub Desktop.
Save MotiurRahman/2d2c0579e497bee91cc912e6cc96a57e to your computer and use it in GitHub Desktop.
var win = Titanium.UI.createWindow({
title : 'Audio Test',
backgroundColor : '#fff',
//layout : 'vertical'
});
var url = encodeURIComponent("https://itunes.apple.com/us/app/smartuaq/id1063110068?ls=1&mt=8").replace(/'/g,"%27").replace(/"/g,"%22");
var whatsappUrl = 'whatsapp://send?text=' + url;
var clickme = Ti.UI.createButton({
title : 'Click Me',
});
// Listen for click events.
clickme.addEventListener('click', function() {
if (Ti.Platform.osname !== 'android') {
if (Ti.Platform.canOpenURL(whatsappUrl)) {
Ti.Platform.openURL(whatsappUrl);
} else {
Ti.Platform.openURL("https://itunes.apple.com/ae/app/whatsapp-messenger/id310633997?mt=8");
}
} else {
var isSuccess = Ti.Platform.openURL(whatsappUrl);
if (!isSuccess) {
Ti.Platform.openURL("https://play.google.com/store/apps/details?id=com.whatsapp&hl=en");
}
}
});
// Add to the parent view.
win.add(clickme);
win.open();
<ios>
<plist>
<dict>
<key>UISupportedInterfaceOrientations~iphone</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UIRequiresPersistentWiFi</key>
<false/>
<key>UIPrerenderedIcon</key>
<false/>
<key>UIStatusBarHidden</key>
<false/>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleDefault</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>twitter</string>
<string>whatsapp</string>
</array>
</dict>
</plist>
</ios>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment