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 🙏

© 2026 – Pkg Stats / Ryan Hefner

turbo-vps-inappupdate

v0.1.1

Published

playstore app updates

Readme

turbo-vps-inappupdate

Google Play in-app update detector for React Native applications.

Installation

npm install turbo-vps-inappupdate

Usage

import SpInAppUpdates, { IAUUpdateKind, IAUInstallStatus } from "turbo-vps-inappupdate";
import DeviceInfo from 'react-native-device-info'; // Required for getting app version
import { Platform } from 'react-native';

// Initialize the in-app updates instance
const inAppUpdates = new SpInAppUpdates(
  false // isDebug - set to true for debugging
);

// Check for updates and start update process
inAppUpdates
  .checkNeedsUpdate({ curVersion: DeviceInfo.getVersion() })
  .then((result) => {
    if (result.shouldUpdate) {
      let updateOptions = {};
      
      if (Platform.OS === "android") {
        updateOptions = {
          updateType: IAUUpdateKind.FLEXIBLE, // Options: IMMEDIATE or FLEXIBLE
        };
      }
      
      inAppUpdates.startUpdate(updateOptions);
    }
  });

// Listen for update status changes
const updateListener = inAppUpdates.addStatusUpdateListener((downloadStatus) => {
  if (downloadStatus.status === IAUInstallStatus.DOWNLOADED) {
    // Install the downloaded update
    inAppUpdates.installUpdate();
    
    // Clean up listener after installation
    inAppUpdates.removeStatusUpdateListener((finalStatus) => {});
  }
});

// Cleanup function (use in useEffect cleanup or component unmount)
const cleanup = () => {
  if (typeof unsubscribe === 'function') {
    unsubscribe();
  }
  if (updateListener) {
    inAppUpdates.removeStatusUpdateListener(updateListener);
  }
};

// Don't forget to call cleanup when component unmounts
// cleanup();

React Hook Example

import { useEffect } from 'react';
import SpInAppUpdates, { IAUUpdateKind, IAUInstallStatus } from "turbo-vps-inappupdate";
import DeviceInfo from 'react-native-device-info';
import { Platform } from 'react-native';

const useInAppUpdates = () => {
  useEffect(() => {
    const inAppUpdates = new SpInAppUpdates(false);
    
    // Check for updates
    inAppUpdates
      .checkNeedsUpdate({ curVersion: DeviceInfo.getVersion() })
      .then((result) => {
        if (result.shouldUpdate) {
          let updateOptions = {};
          
          if (Platform.OS === "android") {
            updateOptions = {
              updateType: IAUUpdateKind.FLEXIBLE,
            };
          }
          
          inAppUpdates.startUpdate(updateOptions);
        }
      });

    // Listen for download completion
    const updateListener = inAppUpdates.addStatusUpdateListener((downloadStatus) => {
      if (downloadStatus.status === IAUInstallStatus.DOWNLOADED) {
        inAppUpdates.installUpdate();
        inAppUpdates.removeStatusUpdateListener((finalStatus) => {});
      }
    });

    // Cleanup function
    return () => {
      if (updateListener) {
        inAppUpdates.removeStatusUpdateListener(updateListener);
      }
    };
  }, []);
};

API Reference

Classes

  • SpInAppUpdates: Main class for handling in-app updates
    • Constructor: new SpInAppUpdates(isDebug: boolean)

Methods

  • checkNeedsUpdate(options): Check if app needs an update

    • options.curVersion: Current app version string
    • Returns: Promise with update availability info
  • startUpdate(updateOptions): Start the update process

    • updateOptions.updateType: Update type (IAUUpdateKind.FLEXIBLE or IAUUpdateKind.IMMEDIATE)
  • installUpdate(): Install a downloaded update

  • addStatusUpdateListener(callback): Listen for update status changes

    • Returns: Listener reference for cleanup
  • removeStatusUpdateListener(listener): Remove status update listener

Enums

  • IAUUpdateKind: Update types

    • FLEXIBLE: User can continue using app while update downloads
    • IMMEDIATE: Update blocks app usage until complete
  • IAUInstallStatus: Installation status values

    • DOWNLOADED: Update has been downloaded and ready to install

Dependencies

This library requires react-native-device-info to get the current app version:

npm install react-native-device-info

Platform Support

  • ✅ Android (Google Play Store)
  • ❌ iOS (Apple doesn't support in-app updates)

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library