{"id":16767225,"url":"https://github.com/j-mendez/react-native-car-connect","last_synced_at":"2025-04-10T19:12:59.669Z","repository":{"id":57335990,"uuid":"210453791","full_name":"j-mendez/react-native-car-connect","owner":"j-mendez","description":"car connectivity detection for react-native","archived":false,"fork":false,"pushed_at":"2020-10-09T12:02:39.000Z","size":612,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-29T15:22:45.851Z","etag":null,"topics":["react-native","react-native-car","react-native-media-channels","react-native-vehicle"],"latest_commit_sha":null,"homepage":"https://appadvice.com/app/carsight/1481029330","language":"Swift","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/j-mendez.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}},"created_at":"2019-09-23T21:13:51.000Z","updated_at":"2024-01-30T12:37:13.000Z","dependencies_parsed_at":"2022-09-11T02:01:05.648Z","dependency_job_id":null,"html_url":"https://github.com/j-mendez/react-native-car-connect","commit_stats":null,"previous_names":["jeffreymendez1993/react-native-car-connect"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-mendez%2Freact-native-car-connect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-mendez%2Freact-native-car-connect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-mendez%2Freact-native-car-connect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-mendez%2Freact-native-car-connect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/j-mendez","download_url":"https://codeload.github.com/j-mendez/react-native-car-connect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248280134,"owners_count":21077410,"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":["react-native","react-native-car","react-native-media-channels","react-native-vehicle"],"created_at":"2024-10-13T06:08:41.137Z","updated_at":"2025-04-10T19:12:59.638Z","avatar_url":"https://github.com/j-mendez.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-car-connect\n\n## About\n\nDetect when your phone connects or disconnects to your car (handsfree/bluetooth)\nCurrently only working for iOS. Android will be available soon.\n\n![Alt Text](example.png)\n\n## Getting started\n\n`$ npm install react-native-car-connect --save`\n\n### Mostly automatic installation\n\n`$ react-native link react-native-car-connect`\n\n### Manual installation\n\n#### iOS\n\n1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`\n2. Go to `node_modules` ➜ `react-native-car-connect` and add `CarConnect.xcodeproj`\n3. In XCode, in the project navigator, select your project. Add `libCarConnect.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`\n4. Run your project (`Cmd+R`)\u003c\n\n#### Android\n\n1. Open up `android/app/src/main/java/[...]/MainApplication.java`\n\n- Add `import com.reactlibrary.CarConnectPackage;` to the imports at the top of the file\n- Add `new CarConnectPackage()` to the list returned by the `getPackages()` method\n\n2. Append the following lines to `android/settings.gradle`:\n   ```\n   include ':react-native-car-connect'\n   project(':react-native-car-connect').projectDir = new File(rootProject.projectDir, \t'../node_modules/react-native-car-connect/android')\n   ```\n3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:\n   ```\n     compile project(':react-native-car-connect')\n   ```\n\n## Usage\n\n```javascript\nimport { useEffect } from \"react\";\nimport CarConnect from \"react-native-car-connect\";\nimport { NativeEventEmitter } from \"react-native\";\n\nconst CarEvents = new NativeEventEmitter(CarConnect);\n\nfunction ConnectFunctionalComponent() {\n  useEffect(\n    () =\u003e {\n      CarEvents.addListener(\"onConnect\", res =\u003e {\n        alert(\"Car connected state = \", res);\n      });\n      CarEvents.addListener(\"onDisconnect\", res =\u003e {\n        alert(\"Car disconnected state = \", res);\n      });\n      // pass in true to use background thread\n      CarConnect.start(true);\n      return () =\u003e {\n        CarConnect.stop(true);\n      };\n    },\n    [],\n    []\n  );\n\n  return null;\n}\n\n// check if connected\nconsole.log(CarConnect.connected);\n\n// example usage with functional component\nfunction App() {\n  return \u003cConnectFunctionalComponent /\u003e;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-mendez%2Freact-native-car-connect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj-mendez%2Freact-native-car-connect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-mendez%2Freact-native-car-connect/lists"}