How to use the expo-location.startLocationUpdatesAsync function in expo-location

To help you get started, we’ve selected a few expo-location examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flow-typed / flow-typed / definitions / npm / expo-location_v5.x.x / flow_v0.104.x- / test_expo-location.js View on Github external
it('should raise an error when call function with invalid arguments', () => {
    // $ExpectError: first argument is required
    startLocationUpdatesAsync();

    // $ExpectError: first argument mush be a string
    startLocationUpdatesAsync(1337);

    // $ExpectError: second argument must be an object
    startLocationUpdatesAsync('taskName', 69);

    startLocationUpdatesAsync('taskName', {
      // $ExpectError: invalid accuracy
      accuracy: 1,
      // $ExpectError: invalid activityType
      activityType: 1,

      // $ExpectError: `notificationTitle` is required props
      foregroundService: { notificationBody: 'str' },
    });
  });
});
github flow-typed / flow-typed / definitions / npm / expo-location_v5.x.x / flow_v0.104.x- / test_expo-location.js View on Github external
it('should raise an error when call function with invalid arguments', () => {
    // $ExpectError: first argument is required
    startLocationUpdatesAsync();

    // $ExpectError: first argument mush be a string
    startLocationUpdatesAsync(1337);

    // $ExpectError: second argument must be an object
    startLocationUpdatesAsync('taskName', 69);

    startLocationUpdatesAsync('taskName', {
      // $ExpectError: invalid accuracy
      accuracy: 1,
      // $ExpectError: invalid activityType
      activityType: 1,

      // $ExpectError: `notificationTitle` is required props
      foregroundService: { notificationBody: 'str' },
    });
  });
});
github flow-typed / flow-typed / definitions / npm / expo-location_v5.x.x / flow_v0.104.x- / test_expo-location.js View on Github external
it('should raise an error when call function with invalid arguments', () => {
    // $ExpectError: first argument is required
    startLocationUpdatesAsync();

    // $ExpectError: first argument mush be a string
    startLocationUpdatesAsync(1337);

    // $ExpectError: second argument must be an object
    startLocationUpdatesAsync('taskName', 69);

    startLocationUpdatesAsync('taskName', {
      // $ExpectError: invalid accuracy
      accuracy: 1,
      // $ExpectError: invalid activityType
      activityType: 1,

      // $ExpectError: `notificationTitle` is required props
      foregroundService: { notificationBody: 'str' },
    });
  });
});
github flow-typed / flow-typed / definitions / npm / expo-location_v5.x.x / flow_v0.104.x- / test_expo-location.js View on Github external
startLocationUpdatesAsync('taskName', {
      foregroundService: {
        notificationTitle: 'str',
        notificationBody: 'str',
      },
    });

    startLocationUpdatesAsync('taskName', {
      foregroundService: {
        notificationTitle: 'str',
        notificationBody: 'str',
        notificationColor: 'red',
      },
    });

    startLocationUpdatesAsync('taskName').then(result => {
      (result: void);

      // $ExpectError: check any
      (result: string);
    });
  });
github expo / expo / apps / native-component-list / src / screens / Location / BackgroundLocationMapScreen.tsx View on Github external
async startLocationUpdates(accuracy = this.state.accuracy) {
    await Location.startLocationUpdatesAsync(LOCATION_UPDATES_TASK, {
      accuracy,
      activityType: this.state.activityType,
      pausesUpdatesAutomatically: this.state.activityType != null,
      showsBackgroundLocationIndicator: this.state.showsBackgroundLocationIndicator,
      deferredUpdatesInterval: 60 * 1000, // 1 minute
      deferredUpdatesDistance: 100, // 100 meters
      foregroundService: {
        notificationTitle: 'expo-location-demo',
        notificationBody: 'Background location is running...',
        notificationColor: Colors.tintColor,
      },
    });

    if (!this.state.isTracking) {
      alert(
        // tslint:disable-next-line max-line-length
github expo / expo / home / screens / LocationDiagnosticsScreen.js View on Github external
async startLocationUpdates(accuracy = this.state.accuracy) {
    await Location.startLocationUpdatesAsync(LOCATION_UPDATES_TASK, {
      accuracy,
      showsBackgroundLocationIndicator: this.state.showsBackgroundLocationIndicator,
    });

    if (!this.state.isTracking) {
      alert(
        'Now you can send app to the background, go somewhere and come back here! You can even terminate the app and it will be woken up when the new significant location change comes out.'
      );
    }
    this.setState({ isTracking: true });
  }