How to use the expo.Permissions.LOCATION function in expo

To help you get started, we’ve selected a few expo 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 JumboCode / NorthShoreCDC / PUAMapp / ExplorePage.js View on Github external
import { pink } from "./colors.js";
import { Feather } from '@expo/vector-icons';
import  MapView from 'react-native-maps';
import { isIOS } from "./utilities";

const INITIAL_LAT = 42.518217;
const INITIAL_LONG = -70.891919;
const INITIAL_DELTA = 0.005;
const ZOOM_IN_DELTA = .001;

const ANIMATION_DELAY = 500;
const ANIMATION_DURATION = 1000;

// This triggers asking the user for location permissions.
// This won't do anything if the permission is already granted.
Permissions.askAsync(Permissions.LOCATION);


let exploreStyles = {};

// Note: For all intents and purposes, "mural key" is the same as "mural id".
// But "mural index" does not refer to either of those things, it only refers
// to a mural's order in the tour.
export default class ExplorePage extends React.Component {
  constructor(props) {
    super(props);
    self = this;

    // Where we will store the refs to all the markers
    // This is necessary because showing and hiding a callout must be done imperatively.
    this.markers = {};
github EvanBacon / pro-chat / client / src / constants / Settings.js View on Github external
relationships: 'relationships',
    users: 'users',
    complaints: 'complaints',
  },
  isDetached: false,
  googleLoginProps,
  facebookFields: fields,
  facebookLoginProps: {
    permissions: [
      'public_profile',
      'email',
      // 'user_friends'
    ],
  },
  permissions: [
    Permissions.LOCATION,
    Permissions.NOTIFICATIONS,
    Permissions.CONTACTS,
  ],
  hideBooty: true,
  noName: 'Sasuke Uchiha',
  isIos: Platform.OS === 'ios',
  osVersion: sizeInfo.osVersion,
  loginBehavior: sizeInfo.loginBehavior,
  isRunningInExpo: sizeInfo.isRunningInExpo,
  isIPhone: sizeInfo.isIPhone,
  isIPad: sizeInfo.isIPad,
  isIPhoneX: sizeInfo.isIPhoneX,
  bottomInset: sizeInfo.bottomInset,
  topInset: sizeInfo.topInset,
  isSimulator: !Constants.isDevice,
  debug,
github jnancy / Eventry / eventry-app / screens / HomeScreen.js View on Github external
_getLocationAsync = async () => {
    let { status } = await Permissions.askAsync(Permissions.LOCATION);
    if (status !== 'granted') {
      this.setState({
        errorMessage: 'Permission to access location was denied',
      });
      return null;
    }
    let location = await Location.getCurrentPositionAsync({});
    this.setState({ location });
    return location;
  };
github syousif94 / frugalmaps / frugalapp / src / Permissions.js View on Github external
{
          text: "Open Settings",
          onPress: () => {
            Linking.openURL("app-settings:");
          }
        }
      ]
    );
    throw new Error("Permission Denied");
  } else if (askStatus === "granted") {
    store.dispatch(Location.actions.set({ authorized: true }));
    return;
  }

  const { status: locationStatus } = await Permissions.askAsync(
    Permissions.LOCATION
  );

  if (locationStatus !== "granted") {
    throw new Error("Permission Denied");
  }

  store.dispatch(Location.actions.set({ authorized: true }));
}
github EvanBacon / pro-chat / client / src / components / chat / Actions.js View on Github external
_getLocationAsync = async () => {
    const { status } = await Permissions.askAsync(Permissions.LOCATION);
    if (status !== 'granted') {
      this.setState({
        errorMessage: 'Permission to access location was denied',
      });
      return null;
    }

    const location = await Location.getCurrentPositionAsync({});
    return location;
  };
github slava-lu / weather / src / modules / location.js View on Github external
const getLocationSaga = function* () {
  yield put({ type: GET_LOCATION_REQUEST });
  try {
    const { status } = yield call(Permissions.askAsync, Permissions.LOCATION);
    if (status === 'granted') {
      const location = yield call(Location.getCurrentPositionAsync, {});
      yield put({ type: GET_LOCATION_SUCCESS, payload: location  });
      yield put({ type: GET_WEATHER_FORECAST_TRIGGER });
    } else {
      yield put({ type: GET_LOCATION_FAILURE, payload: 'Permission to access location was denied' });
    }
  } catch (error) {
    yield put({ type: GET_LOCATION_FAILURE, payload: { isClientError: true, errorMessage: error.message } });
  }
};
github syousif94 / frugalmaps / frugalapp / src / store / index.js View on Github external
async function checkLocationPermission() {
  const { status: locationStatus } = await Permissions.getAsync(
    Permissions.LOCATION
  );

  if (locationStatus === "granted") {
    store.dispatch(Location.actions.set({ authorized: true }));
  }
}
github satanworker / spaceapps_react_native / modules / Fire / components / FireMap.js View on Github external
async getPremissions() {
    let { status } = await Permissions.askAsync(Permissions.LOCATION)
    if (status === 'granted') {
      const location = await Location.getCurrentPositionAsync({})
      this.props.changeLocation(location)
    }
  }
github syousif94 / frugalmaps / frugalapp / src / store / eventsEpics.js View on Github external
Observable.defer(async () => {
        const time = moment();
        const body = {
          now: time.valueOf(),
          utc: time.utcOffset()
        };

        let coordinates;

        const { status: locationStatus } = await Permissions.getAsync(
          Permissions.LOCATION
        );

        if (locationStatus === "granted") {
          const {
            coords: { latitude, longitude }
          } = await locate();

          body.lat = latitude;
          body.lng = longitude;

          coordinates = {
            latitude,
            longitude
          };
        }