Skip to content

Check if an app/package is installed on Android in React-Native. Nothing more.

License

Notifications You must be signed in to change notification settings

runtrizapps/react-native-android-appcheck

Repository files navigation

react-native-android-appcheck

npm version CircleCI 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: 1.0 Released

  • Android:
    • Requires Kotlin
  • 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}`);
}());

About

Check if an app/package is installed on Android in React-Native. Nothing more.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors