I'm going thru a RN tutorial right now and the guy is using Expo, which is something I prefer not using.
He's wrote some code to mock a users movement by using some of functions found in Expo-Location, including Location, Accuracy, requestPermissionsAsync, and watchPositionAsync.
I would like to recreate that same script, but use react-native-geolocation-service instead. However, one of the methods he uses from Location is EventEmitter.emit() I don't see any type of method included in Geolocation that is similar to that.
The code he wrote:
import * as Location from 'expo-location'; const tenMetersWithDegrees = 0.0001; const getLocation = increment => { return { timestamp: 100000, coords: { speed: 0, heading: 0, accuracy: 5, altitudeAccuracy: 5, altitude: 5, longitude: -122.9779983 + increment * tenMetersWithDegrees, latitude: 37.5665 + increment * tenMetersWithDegrees, } } } let counter = 0; setInterval(() => { Location.EventEmitter.emit('Expo.locationChanged', { watchId: Location._getCurrentWatchI(), location: getLocation(count) }) counter++ }, 1000);
submitted by /u/jjssjj71
[link] [comments]