4.3.3 • Published 4 months ago

react-native-android-mock-location v4.3.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

react-native-android-mock-location

I BUILT THIS FOR USE ON EXPO, BUT DONT HAVE SUPPORT FOR REACT NATIVE PURE NATIVE MODULE. SO I REBUILT USING EXPO NATIVE MODULES THKS, HAVE FREE TO USE THIS FOR YOUR OWN REACT NATIVE PURE PROJECT

Allow to set mock location to your mobile provider seen

Installation

npm install react-native-android-mock-location

Requirements

  • You need to request user permission to use location first

    Add Permissions:

  • android.permission.ACCESS_MOCK_LOCATION

  • android.permission.ACCESS_COARSE_LOCATION
  • android.permission.ACCESS_FINE_LOCATION

Usage

HOW TO SET MOCK LOCATION

  • If you are trying to mock location, and check with google maps. Maybe you may find some glitch, wich envolve your mock location getting override by your real location after few seconds. To solve this, you have to disable accuray location in settings of your phone.
import {
    stopMockLocation,
    setMockLocation
} from 'react-native-android-mock-location';

type TLocation = {
    latitude: number,
    longitude: number
}
interface IMockLocation {
    location: TLocation
    delay?: number
}

const location = {
    latitude: 222.44,
    longitude: 123.23
}

setMockLocation({
    location: location
});

// or

setMockLocation({
    location: location,
    delay: 120 //default is 100ms
});

STOP MOCK LOCATION

  • This function will stop mock location
import { stopMockLocation } from 'react-native-android-mock-location';

stopMockLocation();
 

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

4.2.6

4 months ago

4.0.5

4 months ago

4.3.1

4 months ago

4.2.5

4 months ago

4.3.3

4 months ago

4.1.0

4 months ago

4.3.0

4 months ago

4.2.1

4 months ago

4.2.0

4 months ago

3.1.4

5 months ago

3.0.0

5 months ago

2.5.5

7 months ago

2.5.2

7 months ago

2.5.0

7 months ago

2.0.8

7 months ago

2.0.5

7 months ago

2.0.0

7 months ago

1.5.0

7 months ago

1.1.0

7 months ago

1.0.0

7 months ago

0.1.0

7 months ago