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

react-native-google-ump

v1.0.0

Published

React Native bindings for Google's User Messaging Platform SDK

Readme

React Native Google UMP

React Native bindings for Google's User Messaging Platform SDK for Android and iOS.

Installation

npm install react-native-google-ump

or

yarn add react-native-google-ump

Add your app ID on Android

Obtain your app ID by following the Help Center instructions.

Add the following to your AndroidManifest.xml after replacing YOUR-APP-ID.

<meta-data
  android:name="com.google.android.gms.ads.APPLICATION_ID"
  android:value="YOUR-APP-ID"/>

Take a look at our example app in the example directory if you're unsure where exactly the meta-data tag belongs.

Add your app ID on iOS

Obtain your app ID by following the Help Center instructions.

Add the following to your Info.plist after replacing YOUR-APP-ID:

<key>GADApplicationIdentifier</key>
<string>YOUR-APP-ID</string>

Usage

The User Messaging Platform SDK is designed to be used in a linear fashion, so is this package. The steps for using the SDK and this package are:

  1. Request the latest consent information.
  2. Check if consent is required.
  3. Check if a form is available and if so load a form.
  4. Present the form.
  5. Provide a way for users to change their consent.

These steps are explained in more detail in the SDK's documentation.

Basic example

import * as React from 'react';
import { Text } from 'react-native';
import UMP, { ConsentStatus } from 'react-native-google-ump';

export default function ConsentScreen() {
  React.useEffect(() => {
    async function effect() {
      // 1. Request the latest consent information
      await UMP.requestConsentInfoUpdate();
      const consentInfo = await UMP.getConsentInfo();

      // 2. Check if consent is required
      if (result.consentStatus == ConsentStatus.REQUIRED) {
        // 3. Check if a form is available...
        if (result.consentFormAvailable) {
          // ... and if so load a form
          await UMP.loadConsentForm();

          // 4. Present the form
          await UMP.showConsentForm();
        }
      }
    }
    effect();
  }, []);

  return <Text>Loading consent info...</Text>;
}

Request the latest consent information

It is recommended that you request an update of the consent information at every app launch. This will determine whether or not your user needs to provide consent.

import UMP from 'react-native-google-ump';

await UMP.requestConsentInfoUpdate({
  underAgeOfConsent: false,
});

Check consent information

import UMP, { ConsentStatus } from 'react-native-google-ump';

const consentInfo = await UMP.getConsentInfo();

if (consentInfo.consentStatus === ConsentStatus.REQUIRED) {
  // Consent is required

  if (consentInfo.consentFormAvailable) {
    // A consent form is available
  }
}

Note that consent information is cached between app sessions and can be read without requesting an info update.

Load the form

Once you've determined that a form is available, the next step is to load the form.

import UMP from 'react-native-google-ump';

await UMP.loadConsentForm();

Present the form

You should determine if the user requires consent prior to presenting the form. If consent is not required, you can still show a form so that your user can change their consent.

import UMP from 'react-native-google-ump';

await UMP.showConsentForm();

Note that a consent form can only be shown once. To show another form you need to call loadConsentForm again.

Testing

Enable debug settings

To use the debug functionality, you need to provide your test device's hashed id. Emulators and simulators have testing enabled by default.

import UMP from 'react-native-google-ump';

await UMP.requestConsentInfoUpdate({
  testDeviceHashedIds: ["test-device-id-here"];
});

Force a geography

This package provides a way to test your app's behavior as though the device was located or not located in the EAA.

import UMP from 'react-native-google-ump';

await UMP.requestConsentInfoUpdate({
  debugGeography: DebugGeography.EEA,
});

await UMP.requestConsentInfoUpdate({
  debugGeography: DebugGeography.NOT_EEA,
});

Reset consent state

For testing it's helpful to reset the state of the SDK to simulate a user's first install experience. This package provides the reset method to do this:

import UMP from 'react-native-google-ump';

await UMP.resetConsentInfo();

Delay app measurement (optional)

By default, the Google Mobile Ads SDK initializes app measurement and begins sending user-level event data to Google immediately when the app starts. If your app requires user consent before these events can be sent, you can delay app measurement until you explicitly initialize the Mobile Ads SDK or load an ad.

To delay app measurement, follow the official instructions for Android and IOS.

Further reading

This readme file only covers basics about the User Messaging Platfom SDK. The SDK's documentation is more detailed and discusses more topics such as mediation, forwarding consent and handling App Tracking Transparency requirements.

Contributing

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

License

MIT