Test & Troubleshoot

Enable Debug Mode

The debug screen is shown using the PilgrimSdk.showDebugScreen method. This screen contains logs sent from Pilgrim SDK and other debugging tools/information. Example usage:

import React, { Component } from 'react';
import { Button } from 'react-native';
import PilgrimSdk from '@foursquare/pilgrim-sdk-react-native';

export default class MyScreen extends Component {
  showDebugScreen = function() {
    PilgrimSdk.showDebugScreen();
  };

  render() {
    return (
      <>
        <Button
          title="Show Debug Screen"
          onPress={() => {
            this.showDebugScreen();
          }}
        />
      </>
    );
  }
}

Test Visits

Test arrival visits can be fired with the method PilgrimSdk.fireTestVisit. You must pass a location to be used for the test visit. The arrival notification will be received via Webhooks and other third-party integrations

import React, { Component } from 'react';
import { Button } from 'react-native';
import PilgrimSdk from '@foursquare/pilgrim-sdk-react-native';

export default class Screen extends Component {
  fireTestVisit = async function() {
    navigator.geolocation.getCurrentPosition(
      position => {
        const latitude = position.coords.latitude;
        const longitude = position.coords.longitude;
        PilgrimSdk.fireTestVisit(latitude, longitude);
        Alert.alert('Pilgrim SDK', `Sent test visit with location: (${latitude},${longitude})`);
      },
      err => {
        Alert.alert('Pilgrim SDK', `${err}`);
      }
    );
  };

  render() {
    return (
      <>
        <Button
          title="Fire Test Visit"
          onPress={() => {
            this.fireTestVisit();
          }}
        />
      </>
    );
  }
}

Did this page help you?