npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-kelter-appavailability

v1.0.3

Published

A Cordova plugin for checking the availability of installed apps using URI schemes (iOS) or package names (Android).

Downloads

10

Readme

AppAvailability for iOS and Android

AppAvailability is a plugin for Apache Cordova that allows you to check if an app is installed on the user's device. It supports both iOS and Android platforms, utilizing URI schemes for iOS and package names for Android.

Important: iOS 9+ URL Scheme Whitelist

Apple changed the canOpenURL method on iOS 9. Apps which are checking for URL Schemes have to declare these Schemes as it is submitted to Apple. The article Quick Take on iOS 9 URL Scheme Changes explains the changes in detail.

Important: Android 11+ Google rejecting Android applications due to the QUERY_ALL_PACKAGES used

Google introduced a restriction on the QUERY_ALL_PACKAGES permission for apps on the Android operating system. This permission allowed apps to access a broad range of data on a user's device, potentially including sensitive information. However, its unrestricted usage posed privacy and security risks.

To mitigate these risks, Google implemented restrictions on the use of QUERY_ALL_PACKAGES starting with Android 11. Apps targeting this version and higher must adhere to stricter guidelines when requesting this permission. The Google Help Use of the broad package (App) visibility (QUERY_ALL_PACKAGES) permission explains the changes in detail.

Whitelisting URL Schemes (iOS) and Package Visibility Needs (Android queries)

Beginning with version 1.0.3 (and OS11_1.0.3) of the plugin, you can now easily add URL Schemes to the -Info.plist file and Android Package Queries to the AndoirdManifest.xml file by using Cordova plugin --variable when integrating the plugin into your application.

cordova plugin add https://github.com/kelter-antunes/AppAvailability.git --variable CORDOVA_ANDROID_QUERIES="com.facebook.android,com.twitter.android" --variable CORDOVA_IOS_URL_SCHEMES="facebook,twitter"

For Android:

--variable CORDOVA_ANDROID_QUERIES="com.facebook.android,com.twitter.android"

Will change the AndroidManifest.xml file to:

<queries>
	<package android:name="com.facebook.android"/>
	<package android:name="com.twitter.android"/>
</queries>

For iOS:

--variable CORDOVA_IOS_URL_SCHEMES="facebook,twitter"

Will change the -Info.plist file to:

<key>LSApplicationQueriesSchemes</key>
<array>
	<string>facebook</string>
	<string>twitter</string>
</array>

Both variables accept a list of Packages/URL Schemas separated by commas.

1. Description

This plugin enables you to verify if an app is installed on the user's device. It needs a URI Scheme (like twitter://) on iOS or a Package Name (like com.twitter.android) on Android.

Supported Platforms

  • iOS
  • Android

2. Installation

Simply run this command to add the latest version of AppAvailability from npm to your project:

$ cordova plugin add cordova-plugin-kelter-appavailability --save

Alternatively, you can install AppAvailability from GitHub:

$ cordova plugin add https://github.com/kelter-antunes/AppAvailability.git --save

3. Usage

iOS

appAvailability.check(
    'twitter://', // URI Scheme
    function() {  // Success callback
        console.log('Twitter is available');
    },
    function() {  // Error callback
        console.log('Twitter is not available');
    }
);

Android

appAvailability.check(
    'com.twitter.android', // Package Name
    function(info) {           // Success callback        
        // Info parameter is available only for android
        console.log('Twitter is available, and it\'s version is ', info.version);
    },
    function() {           // Error callback
        console.log('Twitter is not available');
    }
);

Full Example

var scheme;

// Don't forget to add the cordova-plugin-device plugin for `device.platform`
if(device.platform === 'iOS') {
    scheme = 'twitter://';
}
else if(device.platform === 'Android') {
    scheme = 'com.twitter.android';
}

appAvailability.check(
    scheme,       // URI Scheme or Package Name
    function() {  // Success callback
        console.log(scheme + ' is available :)');
    },
    function() {  // Error callback
        console.log(scheme + ' is not available :(');
    }
);

4. Some URI Schemes / Package Names

Twitter:

  • iOS: twitter://
  • Android: com.twitter.android

Facebook:

  • iOS: fb://
  • Android: com.facebook.katana

WhatsApp:

5. License

The MIT License (MIT)

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.