{"id":40663925,"url":"https://github.com/webyonet/react-native-android-location-services-dialog-box","last_synced_at":"2026-01-21T09:05:29.426Z","repository":{"id":57335269,"uuid":"62655221","full_name":"webyonet/react-native-android-location-services-dialog-box","owner":"webyonet","description":"React Native Android Location Services Dialog Box","archived":false,"fork":false,"pushed_at":"2023-06-20T15:15:28.000Z","size":398,"stargazers_count":183,"open_issues_count":8,"forks_count":50,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-10-10T04:26:28.106Z","etag":null,"topics":["android","dialog","dialog-box","geo","geolocation","location","location-services","locations","react","react-native","react-native-geolocation","react-native-location","reactjs"],"latest_commit_sha":null,"homepage":"","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/webyonet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2016-07-05T17:14:38.000Z","updated_at":"2025-01-25T19:33:08.000Z","dependencies_parsed_at":"2024-06-18T15:18:14.651Z","dependency_job_id":"1e7e2e18-4d00-46f6-86bf-65d9cb8834d5","html_url":"https://github.com/webyonet/react-native-android-location-services-dialog-box","commit_stats":{"total_commits":85,"total_committers":18,"mean_commits":4.722222222222222,"dds":0.2823529411764706,"last_synced_commit":"6bfb7be6175f6d09d8557092485e1ea017933ff6"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"purl":"pkg:github/webyonet/react-native-android-location-services-dialog-box","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webyonet%2Freact-native-android-location-services-dialog-box","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webyonet%2Freact-native-android-location-services-dialog-box/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webyonet%2Freact-native-android-location-services-dialog-box/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webyonet%2Freact-native-android-location-services-dialog-box/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webyonet","download_url":"https://codeload.github.com/webyonet/react-native-android-location-services-dialog-box/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webyonet%2Freact-native-android-location-services-dialog-box/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28630939,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","dialog","dialog-box","geo","geolocation","location","location-services","locations","react","react-native","react-native-geolocation","react-native-location","reactjs"],"created_at":"2026-01-21T09:05:28.822Z","updated_at":"2026-01-21T09:05:29.419Z","avatar_url":"https://github.com/webyonet.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## React Native Android Location Services Dialog Box\n\u003cimg width=\"274px\" align=\"right\" src=\"https://raw.githubusercontent.com/webyonet/react-native-android-location-services-dialog-box/master/demo.gif\" /\u003e\n\nA react-native component for turn on the dialog box from android location services\n\n\n[![GitHub tag](https://img.shields.io/github/tag/webyonet/react-native-android-location-services-dialog-box.svg)](https://github.com/webyonet/react-native-android-location-services-dialog-box)\n[![npm version](https://badge.fury.io/js/react-native-android-location-services-dialog-box.svg)](https://badge.fury.io/js/react-native-android-location-services-dialog-box)\n![npm](https://img.shields.io/npm/dm/react-native-android-location-services-dialog-box.svg)\n![npm](https://img.shields.io/npm/dt/react-native-android-location-services-dialog-box.svg)\n![npm](https://img.shields.io/npm/l/react-native-android-location-services-dialog-box.svg)\n\n### Installation\n\n#### Mostly automatic installation (recommended)\n\n1. `yarn add react-native-android-location-services-dialog-box`\n\u003cbr/\u003eor\u003cbr/\u003e\n`npm install react-native-android-location-services-dialog-box --save`\n2. `react-native link react-native-android-location-services-dialog-box`\n\n#### Manual Installation\n\n##### Android\n\n1. `yarn add react-native-android-location-services-dialog-box`\n\u003cbr/\u003eor\u003cbr/\u003e\n`npm install react-native-android-location-services-dialog-box --save`\n2. Make the following additions to the given files:\n\n**android/settings.gradle**\n\n```gradle\ninclude ':react-native-android-location-services-dialog-box'\nproject(':react-native-android-location-services-dialog-box').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-android-location-services-dialog-box/android')\n```\n\n**android/app/build.gradle**\n\n```gradle\ndependencies {\n   ...\n   compileOnly project(':react-native-android-location-services-dialog-box')\n}\n```\n\n**MainApplication.java**\n\nOn top, where imports are:\n```java\nimport com.showlocationservicesdialogbox.LocationServicesDialogBoxPackage;\n```\n\nUnder `protected List\u003cReactPackage\u003e getPackages() {`:  \n```java\n  return Arrays.\u003cReactPackage\u003easList(\n    new MainReactPackage(),\n    new LocationServicesDialogBoxPackage() // \u003c== this\n  );\n```\n\n### Usage\n\n```javascript\nimport { BackHandler, DeviceEventEmitter } from 'react-native';\nimport LocationServicesDialogBox from \"react-native-android-location-services-dialog-box\";\n\nLocationServicesDialogBox.checkLocationServicesIsEnabled({\n    message: \"\u003ch2 style='color: #0af13e'\u003eUse Location ?\u003c/h2\u003eThis app wants to change your device settings:\u003cbr/\u003e\u003cbr/\u003eUse GPS, Wi-Fi, and cell network for location\u003cbr/\u003e\u003cbr/\u003e\u003ca href='#'\u003eLearn more\u003c/a\u003e\",\n    ok: \"YES\",\n    cancel: \"NO\",\n    enableHighAccuracy: true, // true =\u003e GPS AND NETWORK PROVIDER, false =\u003e GPS OR NETWORK PROVIDER\n    showDialog: true, // false =\u003e Opens the Location access page directly\n    openLocationServices: true, // false =\u003e Directly catch method is called if location services are turned off\n    preventOutSideTouch: false, // true =\u003e To prevent the location services window from closing when it is clicked outside\n    preventBackClick: false, // true =\u003e To prevent the location services popup from closing when it is clicked back button\n    providerListener: false // true ==\u003e Trigger locationProviderStatusChange listener when the location state changes\n}).then(function(success) {\n    console.log(success); // success =\u003e {alreadyEnabled: false, enabled: true, status: \"enabled\"}\n}).catch((error) =\u003e {\n    console.log(error.message); // error.message =\u003e \"disabled\"\n});\n\nBackHandler.addEventListener('hardwareBackPress', () =\u003e { //(optional) you can use it if you need it\n   //do not use this method if you are using navigation.\"preventBackClick: false\" is already doing the same thing.\n   LocationServicesDialogBox.forceCloseDialog();\n});\n\nDeviceEventEmitter.addListener('locationProviderStatusChange', function(status) { // only trigger when \"providerListener\" is enabled\n    console.log(status); //  status =\u003e {enabled: false, status: \"disabled\"} or {enabled: true, status: \"enabled\"}\n});\n\ncomponentWillUnmount() {\n    // used only when \"providerListener\" is enabled\n    LocationServicesDialogBox.stopListener(); // Stop the \"locationProviderStatusChange\" listener\n}\n```\n\n### Configure Colors\n\n```javascript\nimport LocationServicesDialogBox from \"react-native-android-location-services-dialog-box\";\n\nLocationServicesDialogBox.checkLocationServicesIsEnabled({\n    message: \"\u003cfont color='#f1eb0a'\u003eUse Location ?\u003c/font\u003e\",\n    ok: \"YES\",\n    cancel: \"NO\",\n    style: { // (optional)\n        backgroundColor: '#87a9ea',// (optional)\n        \n        positiveButtonTextColor: '#ffffff',// (optional)\n        positiveButtonBackgroundColor: '#5fba7d',// (optional)\n        \n        negativeButtonTextColor: '#ffffff',// (optional)\n        negativeButtonBackgroundColor: '#ba5f5f'// (optional)\n    }\n}).then(function(success) {\n    console.log(success);\n}).catch((error) =\u003e {\n    console.log(error.message);\n});\n\n```\n\u003cimg width=\"529\" alt=\"screen shot 2018-07-07 at 16 58 28\" src=\"https://user-images.githubusercontent.com/973302/42411805-3246281a-820b-11e8-862c-8d8cd12d90f3.png\"/\u003e\n\n### Usage And Example For Async Method `ES6`\n\n```javascript\nimport { BackHandler, DeviceEventEmitter } from 'react-native';\nimport LocationServicesDialogBox from \"react-native-android-location-services-dialog-box\";\n\nexport default class LocationServiceTestPage extends Component {\n    constructor(props){\n        super(props);\n        \n        this.checkIsLocation().catch(error =\u003e error);\n        \n        DeviceEventEmitter.addListener('locationProviderStatusChange', function(status) { // only trigger when \"providerListener\" is enabled\n            console.log(status); //  status =\u003e {enabled: false, status: \"disabled\"} or {enabled: true, status: \"enabled\"}\n        });\n    }\n    \n    async checkIsLocation():Promise {\n        let check = await LocationServicesDialogBox.checkLocationServicesIsEnabled({\n            message: \"Use Location ?\",\n            ok: \"YES\",\n            cancel: \"NO\",\n            enableHighAccuracy: true, // true =\u003e GPS AND NETWORK PROVIDER, false =\u003e GPS OR NETWORK PROVIDER\n            showDialog: true, // false =\u003e Opens the Location access page directly\n            openLocationServices: true, // false =\u003e Directly catch method is called if location services are turned off\n            preventOutSideTouch: false, //true =\u003e To prevent the location services window from closing when it is clicked outside\n            preventBackClick: false, //true =\u003e To prevent the location services popup from closing when it is clicked back button\n            providerListener: true // true ==\u003e Trigger \"locationProviderStatusChange\" listener when the location state changes\n        }).catch(error =\u003e error);\n\n        return Object.is(check.status, \"enabled\");\n    }\n    \n    componentWillUnmount() {\n        // used only when \"providerListener\" is enabled\n        LocationServicesDialogBox.stopListener(); // Stop the \"locationProviderStatusChange\" listener\n    }   \n}\n```\n\n### Examples `ES6`\n```javascript\nimport React, { Component } from 'react';\nimport {\n    AppRegistry,\n    Text,\n    View,\n    BackHandler,\n    DeviceEventEmitter\n} from 'react-native';\n\nimport LocationServicesDialogBox from \"react-native-android-location-services-dialog-box\";\n\nclass SampleApp extends Component {\n    state = {\n        initialPosition: 'unknown',\n    };\n\n    componentDidMount() {\n        LocationServicesDialogBox.checkLocationServicesIsEnabled({\n            message: \"\u003ch2\u003eUse Location ?\u003c/h2\u003eThis app wants to change your device settings:\u003cbr/\u003e\u003cbr/\u003eUse GPS, Wi-Fi, and cell network for location\u003cbr/\u003e\u003cbr/\u003e\u003ca href='#'\u003eLearn more\u003c/a\u003e\",\n            ok: \"YES\",\n            cancel: \"NO\",\n            enableHighAccuracy: true, // true =\u003e GPS AND NETWORK PROVIDER, false =\u003e GPS OR NETWORK PROVIDER\n            showDialog: true, // false =\u003e Opens the Location access page directly\n            openLocationServices: true, // false =\u003e Directly catch method is called if location services are turned off\n            preventOutSideTouch: false, //true =\u003e To prevent the location services popup from closing when it is clicked outside\n            preventBackClick: false, //true =\u003e To prevent the location services popup from closing when it is clicked back button\n            providerListener: true // true ==\u003e Trigger \"locationProviderStatusChange\" listener when the location state changes\n        }).then(function(success) {\n            // success =\u003e {alreadyEnabled: true, enabled: true, status: \"enabled\"} \n                navigator.geolocation.getCurrentPosition((position) =\u003e {\n                    let initialPosition = JSON.stringify(position);\n                    this.setState({ initialPosition });\n                }, error =\u003e console.log(error), { enableHighAccuracy: false, timeout: 20000, maximumAge: 1000 });\n            }.bind(this)\n        ).catch((error) =\u003e {\n            console.log(error.message);\n        });\n        \n        DeviceEventEmitter.addListener('locationProviderStatusChange', function(status) { // only trigger when \"providerListener\" is enabled\n            console.log(status); //  status =\u003e {enabled: false, status: \"disabled\"} or {enabled: true, status: \"enabled\"}\n        });\n    }\n    \n    componentWillUnmount() {\n        // used only when \"providerListener\" is enabled\n        LocationServicesDialogBox.stopListener(); // Stop the \"locationProviderStatusChange\" listener.\n    } \n\n    render() {\n        return (\n            \u003cView\u003e\n                \u003cText\u003e\n                    Geolocation: {this.state.initialPosition}\n                \u003c/Text\u003e\n            \u003c/View\u003e\n        );\n    }\n}\nAppRegistry.registerComponent('SampleApp', () =\u003e SampleApp);\n```\n\n### Props\n\n| Prop                              | Type        | Default     | Description                                                                              |\n|-----------------------------------|-------------|-------------|------------------------------------------------------------------------------------------|\n|`message`                          |`HTML`       |`null`       |Dialog box content text                                                                   |\n|`ok`                               |`String`     |`null`       |Dialog box ok button text                                                                 |\n|`cancel`                           |`String`     |`null`       |Dialog box cancel button text                                                             |\n|`enableHighAccuracy` (optional)    |`Boolean`    |`true`       |Provider switch (GPS OR NETWORK OR GPS AND NETWORK)                                       |\n|`showDialog` (optional)            |`Boolean`    |`true`       |Indicate whether to display the dialog box                                                |\n|`openLocationServices` (optional)  |`Boolean`    |`true`       |Indicate whether to display the location services screen                                  |\n|`preventOutSideTouch` (optional)   |`Boolean`    |`true`       |To prevent the location services window from closing when it is clicked outside           |\n|`preventBackClick` (optional)      |`Boolean`    |`true`       |To prevent the location services popup from closing when it is clicked back button        |\n|`providerListener` (optional)      |`Boolean`    |`false`      |Used to trigger `locationProviderStatusChange listener when the location state changes.  |\n|`style` (optional)      |`Object`    |`{}`      |Change colors|\n\n### Methods\n\n| Name                               | Return             | Return Value     |\n|------------------------------------|--------------------|------------------|\n|`checkLocationServicesIsEnabled`    | Promise            | Object           |\n|`forceCloseDialog` (optional using) | void               | -                |\n|`stopListener` (optional using)     | void               | -                |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebyonet%2Freact-native-android-location-services-dialog-box","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebyonet%2Freact-native-android-location-services-dialog-box","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebyonet%2Freact-native-android-location-services-dialog-box/lists"}