{"id":18486680,"url":"https://github.com/douglasjunior/react-native-get-location","last_synced_at":"2025-05-15T08:08:44.257Z","repository":{"id":43642851,"uuid":"168354983","full_name":"douglasjunior/react-native-get-location","owner":"douglasjunior","description":"⚛ Simple to use React Native library to get native device location for Android and iOS.","archived":false,"fork":false,"pushed_at":"2025-05-10T01:48:52.000Z","size":815,"stargazers_count":233,"open_issues_count":2,"forks_count":43,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-10T02:42:28.396Z","etag":null,"topics":["android","gps","hacktoberfest","ios","location","react-native"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/react-native-get-location","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/douglasjunior.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"douglasjunior","patreon":"douglasjunior","custom":"paypal.me/douglasnassif"}},"created_at":"2019-01-30T14:19:55.000Z","updated_at":"2025-04-28T00:02:58.000Z","dependencies_parsed_at":"2023-12-19T11:08:47.254Z","dependency_job_id":"5d10d3cf-2788-4928-b736-ac6fbc680dcd","html_url":"https://github.com/douglasjunior/react-native-get-location","commit_stats":{"total_commits":88,"total_committers":6,"mean_commits":"14.666666666666666","dds":"0.46590909090909094","last_synced_commit":"3b4d22f4e03baaa7a9796d0ff7bdb24e642aadd7"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/douglasjunior%2Freact-native-get-location","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/douglasjunior%2Freact-native-get-location/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/douglasjunior%2Freact-native-get-location/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/douglasjunior%2Freact-native-get-location/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/douglasjunior","download_url":"https://codeload.github.com/douglasjunior/react-native-get-location/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253356240,"owners_count":21895670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","gps","hacktoberfest","ios","location","react-native"],"created_at":"2024-11-06T12:49:43.813Z","updated_at":"2025-05-15T08:08:44.231Z","avatar_url":"https://github.com/douglasjunior.png","language":"Java","funding_links":["https://github.com/sponsors/douglasjunior","https://patreon.com/douglasjunior","paypal.me/douglasnassif","https://www.patreon.com/douglasjunior","https://paypal.me/douglasnassif"],"categories":["Java"],"sub_categories":[],"readme":"# React-Native Get Location\n\n[![License MIT](https://img.shields.io/badge/licence-MIT-blue.svg)](https://github.com/douglasjunior/react-native-get-location/blob/master/LICENSE)\n[![npm version](https://img.shields.io/npm/v/react-native-get-location.svg)](https://www.npmjs.com/package/react-native-get-location)\n[![npm downloads](https://img.shields.io/npm/dt/react-native-get-location.svg)](https://www.npmjs.com/package/react-native-get-location?activeTab=versions)\n\n⚛ Simple to use React Native library to get native device location for Android and iOS.\n\n## Requirements\n\n- React Native \u003e= 0.60.0\n- iOS \u003e= 9.0\n\n## Install\n\nInstall dependency package\n```bash\nyarn add react-native-get-location\n```\nOr\n```bash\nnpm i -S react-native-get-location\n```\n\nGo to the folder **your-project/ios** and run `pod install`, and you're done. \n\n## Android post install\n\nFor Android you need to define the location permissions on `AndroidManifest.xml`.\n\n```xml\n\u003c!-- Define ACCESS_FINE_LOCATION if you will use enableHighAccuracy=true  --\u003e\n\u003cuses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/\u003e\n\n\u003c!-- Define ACCESS_COARSE_LOCATION if you will use enableHighAccuracy=false  --\u003e\n\u003cuses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/\u003e\n```\n\n## iOS post install\n\nYou need to define the permission [NSLocationWhenInUseUsageDescription](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW26) on `Info.plist`.\n\n```xml\n\u003ckey\u003eNSLocationWhenInUseUsageDescription\u003c/key\u003e\n\u003cstring\u003eThis app needs to get your location...\u003c/string\u003e\n```\n\n## Usage\n\nThere is only one function that you need to use to get the user's current location.\n\n```js\nimport GetLocation from 'react-native-get-location'\n\nGetLocation.getCurrentPosition({\n    enableHighAccuracy: true,\n    timeout: 60000,\n})\n.then(location =\u003e {\n    console.log(location);\n})\n.catch(error =\u003e {\n    const { code, message } = error;\n    console.warn(code, message);\n})\n```\n\nFor more details, see the [Sample Project](https://github.com/douglasjunior/react-native-get-location/blob/master/Sample/App.tsx).\n\n## API\n\n### function `GetLocation.getCurrentPosition(LocationConfig)`\n\n**Parameters:**\n   - [`LocationConfig`](#object-locationconfig): Configuration object to determine how to get the user current location.\n\n**Return:**\n   - `Promise\u003c`[`Location`](#object-location)`\u003e`: Promise thats resolve to a Location object.\n\n### Object `LocationConfig`\n\n**Properties:**\n   - `enableHighAccuracy`: Set `true` to use 'fine location' (GPS) our `false` to use 'course location' (Wifi, Bluetooth, 3G). Default: `false`\n   - `timeout`: The max time (in milliseconds) that you want to wait to receive a location. Default: `60000` (60 seconds)\n   - `rationale?`: (Android only) See the [React Native docs](https://reactnative.dev/docs/permissionsandroid#request).\n\n### Object `Location`\n\n**Properties:**\n   - `latitude`: The latitude, in degrees.\n   - `longitude`: The longitude, in degrees.\n   - `altitude`: The altitude if available, in meters above the WGS 84 reference ellipsoid.\n   - `accuracy`: The estimated horizontal accuracy of this location, radial, in meters.\n   - `speed`: The speed if it is available, in meters/second over ground.\n   - `time`: The UTC time of this fix, in milliseconds since January 1, 1970.\n   - `bearing`: *(Android only)* The bearing, in degrees.\n   - `provider`: *(Android only)* The name of the provider that generated this fix.\n   - `verticalAccuracy`: *(iOS only)* The vertical accuracy of the location. Negative if the altitude is invalid.\n   - `course`: *(iOS only)* The course of the location in degrees true North. Negative if course is invalid. (0.0 - 359.9 degrees, 0 being true North)\n\n### Error codes\n\n|Code|Message|\n|-|-|\n|`CANCELLED`|Location cancelled by user or by another request|\n|`UNAVAILABLE`|Location service is disabled or unavailable|\n|`TIMEOUT`|Location request timed out|\n|`UNAUTHORIZED`|Authorization denied|\n\n## Contribute\n\nNew features, bug fixes and improvements are welcome! For questions and suggestions use the [issues](https://github.com/douglasjunior/react-native-get-location/issues).\n\n\u003ca href=\"https://www.patreon.com/douglasjunior\"\u003e\u003cimg src=\"http://i.imgur.com/xEO164Z.png\" alt=\"Become a Patron!\" width=\"200\" /\u003e\u003c/a\u003e\n[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://paypal.me/douglasnassif)\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=douglasjunior/react-native-get-location\u0026type=Date)](https://star-history.com/#douglasjunior/react-native-get-location)\n\n## License\n\n```\nThe MIT License (MIT)\n\nCopyright (c) 2019 Douglas Nassif Roma Junior\n```\n\nSee the full [license file](https://github.com/douglasjunior/react-native-get-location/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdouglasjunior%2Freact-native-get-location","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdouglasjunior%2Freact-native-get-location","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdouglasjunior%2Freact-native-get-location/lists"}