I am trying to have my PhoneGap application link to open a specific users profile page in the Twitter app. I know not everyone has the Twitter app installed on their device
The Problem is that the InAppBrowser plugin was not installed. New versions of PhoneGap/Cordova do not come with all plugins installed- instead you choose what you want your App to have access to.
In terminal cd yourApp and $ cordova plugin add org.apache.cordova.inappbrowser
After doing that, it worked perfectly.
EDIT
Just to branch out a little bit more on how I got my .js to check if twitter was installed or not.
I installed another plugin : AppAvailability for iOS and Android
Then I altered my .js to look like this:
//Twitter checker
// If Mac//
var twitterCheck = function(){
appAvailability.check('twitter://', function(availability) {
// availability is either true or false
if(availability) { window.open('twitter://user?screen_name=xerxesnoble', '_system', 'location=no');}
else{window.open('https://itunes.apple.com/ca/app/twitter/id333903271?mt=8', '_system', 'location=no'); };
});
};
//If Android
var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile");
if(isAndroid) {
twitterCheck = function(){
appAvailability.check('com.twitter.android', function(availability) {
// availability is either true or false
if(availability) {window.open('twitter://user?screen_name=xerxesnoble', '_system', 'location=no');}
else{window.open('https://play.google.com/store/apps/details?id=com.twitter.android', '_system', 'location=no');};
});
};
};
The documentation provided in the AppAvailability plugin was very helpful as well>
Hope that this helps someone!