A Plugin for Cordova / PhoneGap by ohh2ahh
- Description
- Installation 2. Automatically (Command-line Interface) 2. PhoneGap Build
- Usage 3. iOS 3. Android
- Some URI schemes / package names
- License
This plugin allows you to check if an app is installed on the user's device. It requires an URI scheme (e.g. twitter://) on iOS or a package name (e.g com.twitter.android) on Android.
- Ready for the Command-line Interface of Cordova / PhoneGap 3.0 and later
- Works with PhoneGap Build (more information)
- iOS
- Android
The Cordova CLI is the recommended way to install AppAvailability, see The Command-line Interface.
Simply run this command to add AppAvailability to your project:
$ cordova plugin add https://github.com/ohh2ahh/AppAvailability.git
And if you're using PhoneGap instead of Cordova:
$ phonegap local plugin add https://github.com/ohh2ahh/AppAvailability.git
AppAvailability works with PhoneGap build too. You can implement the latest version of the plugin by adding the following xml to your config.xml
:
<gap:plugin name="com.ohh2ahh.plugins.appavailability" />
Or if you want to use an exact version of AppAvailability:
<gap:plugin name="com.ohh2ahh.plugins.appavailability" version="0.2.1" />
There is no need to reference the JavaScript in your index.html
.
❗ The code changed in version 0.2.0! You can find the old docs here.
appAvailability.check('twitter://', function(availability) {
// availability is either true or false
if(availability) { console.log('Twitter is available'); }
});
appAvailability.check('com.twitter.android', function(availability) {
// availability is either true or false
if(availability) { console.log('Twitter is available'); }
});
How do I get the URI scheme / package name?
Twitter:
- iOS:
twitter://
(more schemes) - Android:
com.twitter.android
Facebook:
- iOS:
fb://
(and many more asfb://profile
) - Android:
com.facebook.katana
WhatsApp:
- iOS:
whatsapp://
(only since v. 2.10.1, more information) - Android:
com.whatsapp
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.