Skip to content

Latest commit

 

History

History
78 lines (66 loc) · 2.39 KB

use-application-android-install-referrer.md

File metadata and controls

78 lines (66 loc) · 2.39 KB

useApplicationAndroidInstallReferrer

Get the referrer URL of the installed app with Application

releases builds demo

Other hooks   —   Usage   —   Changelog


expo install @use-expo/application expo-application

Usage

// full hook
const [installReferrer, getInstallReferrer] = useApplicationAndroidInstallReferrer();

// other options
useApplicationAndroidInstallReferrer({ get: false });

Example

import { useApplicationAndroidInstallReferrer } from '@use-expo/application';
import React from 'react';
import { Text, View } from 'react-native';

function ApplicationAndroidInstallReferrerExample() {
    const [installReferrer] = useApplicationAndroidInstallReferrer();

    return (
        <View>
            <Text>Install referrer: {installReferrer || '-'}</Text>
        </View>
    );
}

API

function useApplicationAndroidInstallReferrer(options?: Options): Result;

interface Options {
    /** If it should fetch the application install referrer when mounted, defaults to `true` */
    get?: boolean;
}

type Result = [
    /** The current application install referrer */
    string | undefined,
    /** Callback to manually get the application install referrer */
    () => Promise<void>,
];

with ❤️ byCedric