So I've got some twitter integration in my app, and it's a bit buggy - if the app is installed the twitter site still launches inside my app.
So I was wondering if it's possible to do something like this from within a Phonegap app:
// check whether facebook is (likely to be) installed or not
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb://"]]) {
// Safe to launch the facebook app
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"fb://profile/200538917420"]];
}
The code that I've currently got that launches Twitter is:
var then = (new Date()).getTime();
var msg = encodeURIComponent("My Message");
window.open('twitter://post?message='+msg);
setTimeout(function(){
var now = (new Date()).getTime();
if((now - then)<400){
window.open('http://twitter.com/?status='+msg, '_system');
}
},300);