Logo
Initialize SDK and get device details
To initialise the SDK add the below line of code with the public key you retrieved from Sense client panel. If you don't have a public key create new one and call that below function.
How to Install
copy-icon
npm install sense-react-native
Sample Program
Here you can find the demonstration to do the integration.
copy-icon
import { initSDK, getInfo } from 'sense-react-native';

    // ...

    useEffect(() => {
        init();
    }, []);

    const init = async () => {
        try {
        initSDK({
            public_key: "sensepk__xxxxxxxxx",
            senseInfo: true,
            allowGeoLocation: false,
            tag: "HomeReactNative",
            metaInfo: {
            userId: "user_123",
            device: "Pixel_9",
            }
        });
        getSenseId();
        } catch (e) {
        console.error("SDK Init error", e);
        }
    };
    const getSenseId = async () => {
        try {
        const d = await getInfo();
        setDetails(d)
        } catch (e) {
        console.error("GetSenseId error", e);
        }
    };

    useEffect(() => {
        if (details !== "") {
        let data = JSON.parse(details)
        setSenseId(data['sense_id']);
        setRequestId(data['request_id']);
        }
    }, [details])