react-native-android-appcheck
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

react-native-android-appcheck

npm version CircleCI js-standard-style Dependency Status devDependencies Status typings included npm

Tool to check for install status of apps on Android

Why?

Linking.canOpenURL works well for "Deep Links" with custom schema (e.g. exampleapp://), however it is less useful when an app only implements "App Links" with domain verification (i.e. android:autoVerify="true"). See this Android documentation page: https://developer.android.com/training/app-links/verify-site-associations#the-difference

Since a browser is capable of opening general HTTPS URLs, Linking.canOpenURL('https://applink.exampleapp.com') will always return true, whether or not "exampleapp" is installed.

One real-world example of this is Apple Music on Android. On iOS, the music:// schema can be queried for, but on Android (>= 6.0), only an "app link" is available. In this case, custom schemas are present, but the autoVerify attribute 'locks' the intent-filter to the https domains. Android versions lower than 6.0 are probably still able to query for the custom schemes (autoVerify implemented in 6.0/Marshmallow).

Status

  • Android:
    • Testing functionality
  • iOS:
    • No support planned
  • react-native:
    • supported versions ">= 0.60.5"

Installation

with react-native ">=0.60.5"

0. Setup Swift and Kotlin

  • Modify android/build.gradle:

    buildscript {
      ext {
        ...
    +   kotlinVersion = "1.3.50"
      }
    ...
     
      dependencies {
    +   classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
        ...

1. Install latest version from npm

$ npm i react-native-android-appcheck -S

Demo

Android iOS
??? ???

Example

import checkPackage from 'react-native-android-appcheck'
 
(async function() {
  const isInstalled = await checkPackage('com.chat.fakeapp');
  console.log(`App is installed: ${isInstalled}`);
}());

Reference

prop type default desc
packageName string none Android package name

Readme

Keywords

Package Sidebar

Install

npm i react-native-android-appcheck

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

78.1 kB

Total Files

34

Last publish

Collaborators

  • davidgovea