{"id":16099944,"url":"https://github.com/fooock/phone-tracker","last_synced_at":"2025-03-16T08:32:26.713Z","repository":{"id":47650296,"uuid":"86171454","full_name":"fooock/phone-tracker","owner":"fooock","description":"Phone tracker is an Android library to gather environment signals, like cell towers, wifi access points and gps locations.","archived":false,"fork":false,"pushed_at":"2021-08-19T17:08:38.000Z","size":172,"stargazers_count":186,"open_issues_count":2,"forks_count":57,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-02-27T05:55:55.288Z","etag":null,"topics":["android","cell","gather","gps","gps-location","gps-tracker","java","tracker","wifi"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fooock.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":"2017-03-25T16:27:17.000Z","updated_at":"2025-02-14T08:59:51.000Z","dependencies_parsed_at":"2022-08-28T06:12:02.962Z","dependency_job_id":null,"html_url":"https://github.com/fooock/phone-tracker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fooock%2Fphone-tracker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fooock%2Fphone-tracker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fooock%2Fphone-tracker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fooock%2Fphone-tracker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fooock","download_url":"https://codeload.github.com/fooock/phone-tracker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243806070,"owners_count":20350775,"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","cell","gather","gps","gps-location","gps-tracker","java","tracker","wifi"],"created_at":"2024-10-09T18:44:36.218Z","updated_at":"2025-03-16T08:32:26.182Z","avatar_url":"https://github.com/fooock.png","language":"Java","readme":"# Phone tracker\n[ ![Download](https://api.bintray.com/packages/fooock/maven/phone-tracker/images/download.svg) ](https://bintray.com/fooock/maven/phone-tracker/_latestVersion) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Phone%20tracker-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/5476)\n\nPhone tracker is an Android library to gather environment signals, like cell towers, wifi access points and gps locations. You can configure how to scan. Also you can make hot configuring updates, and be notified when the configuration is updated, among other things.\n\n## Installation\nFor gradle based projects you need to add to your ```build.gradle```\n```gradle\nrepositories {\n    jcenter()\n}\n```\nAnd in your dependencies block add this line\n```gradle\ncompile 'com.fooock:phone-tracker:0.2.1'\n```\n\n## Getting started\nYou only need to create and instance of the ```PhoneTracker``` class and pass the ```Context``` to it\n```java\nPhoneTracker phoneTracker = new PhoneTracker(this);\n```\nNow you can call the ```start()``` method from the tracker instance. The default configuration is used. For default all sensors are enabled.\n\n**Important:** Note that if you are target Android 6.0 or greater, you need to grant location permissions to the application in order to gather environment data. You can listen for missing permissions from the ```PhoneTracker``` class using the ```PhoneTracker.PermissionListener``` interface:\n```java\n// Listen for missing permissions\nphoneTracker.addPermissionListener(new PhoneTracker.PermissionListener() {\n    @Override\n    public void onPermissionNotGranted(String... permission) {\n\n    }\n});\n```\nIf the permissions are not granted, the tracker **can't start**.\n\nTo check if the tracker is running:\n```java\n// Check the state of the tracker\nboolean running = phoneTracker.isRunning();\n```\nTo stop the tracker:\n```java\n// Stop all sensors and don't receive more updates\nphoneTracker.stop();\n```\n## Tracker configuration\nTo create a default ```Configuration```:\n```java\n// Create a default configuration\nConfiguration configuration = new Configuration.Builder().create();\n```\nNow see how you can customize the configuration:\n* **Wifi**\nCreate a Wifi configuration\n```java\n// Create a new wifi configuration\nConfiguration.Wifi wifiConf = new Configuration.Wifi();\nwifiConf.setScanDelay(3000);\n```\n* **Cell**\nCreate a cell configuration\n```java\n// Create a new cell configuration\nConfiguration.Cell cellConf = new Configuration.Cell();\ncellConf.setScanDelay(1000);\n```\n* **GPS**\nCreate a GPS configuration\n```java\n// Create a gps configuration\nConfiguration.Gps gpsConf = new Configuration.Gps();\ngpsConf.setMinDistanceUpdate(10);\ngpsConf.setMinTimeUpdate(7000);\n```\nTo create the new custom configuration:\n```java\n// Create a new custom configuration\nConfiguration configuration = new Configuration.Builder()\n    .useCell(true).cell(cellConf)\n    .useWifi(true).wifi(wifiConf)\n    .useGps(true).gps(gpsConf)\n    .create();\n```\nIn order to make effective the configuration:\n```java\n// Set the init configuration\nphoneTracker.setConfiguration(configuration);\n```\nAlso, if you want to change the current configuration when the tracker is running:\n```java\n// Update the current configuration\nphoneTracker.updateConfiguration(configuration);\n```\nThis method only loads the configuration that has changed, without stopping the tracker. You can listen for configuration changes using the ```PhoneTracker.ConfigurationChangeListener``` interface:\n```java\n// Listen for configuration changes\nphoneTracker.setConfigurationChangeListener(new PhoneTracker.ConfigurationChangeListener(){\n    @Override\n    public void onConfigurationChange(Configuration configuration) {\n\n    }\n});\n```\n## Receiving data\nYou can setup listeners to receive wifi, gps updates and cell tower signals. See below.\n* **Wifi**\n```java\n// Set the listener to receive wifi scans\nphoneTracker.setWifiScanListener(new PhoneTracker.WifiScanListener() {\n    @Override\n    public void onWifiScansReceived(long timestamp, List\u003cScanResult\u003e wifiScans) {\n\n    }\n});\n```\n* **GPS**\n```java\n// Set the listener to receive location updates from gps\nphoneTracker.setGpsLocationListener(new PhoneTracker.GpsLocationListener() {\n    @Override\n    public void onLocationReceived(long timestamp, Location location) {\n\n    }\n});\n```\n* **Cell**\n```java\n// Set the listener for cell scans\nphoneTracker.setCellScanListener(new PhoneTracker.CellScanListener() {\n    @Override\n    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)\n    public void onCellInfoReceived(long timestamp, List\u003cCellInfo\u003e cells) {\n\n    }\n\n    @Override\n    @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)\n    public void onNeighborCellReceived(long timestamp, List\u003cNeighboringCellInfo\u003e cells) {\n\n    }\n});\n```\nNote if your application target from API 17 to 25 you don't need override the ```onNeighborCellReceived(...)```. For this I created an adapter class ```PhoneTracker.CellScanAdapter``` to override only the method you are interested:\n```java\nphoneTracker.setCellScanListener(new PhoneTracker.CellScanAdapter() {\n    @Override\n    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)\n    public void onCellInfoReceived(long timestamp, List\u003cCellInfo\u003e cells) {\n\n    }\n});\n```\n\n## License\n```\nCopyright 2017 newhouse (nhitbh at gmail dot com)\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\n\n\n[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax)\n\n\n   [dill]: \u003chttps://github.com/joemccann/dillinger\u003e\n   [git-repo-url]: \u003chttps://github.com/joemccann/dillinger.git\u003e\n   [john gruber]: \u003chttp://daringfireball.net\u003e\n   [df1]: \u003chttp://daringfireball.net/projects/markdown/\u003e\n   [markdown-it]: \u003chttps://github.com/markdown-it/markdown-it\u003e\n   [Ace Editor]: \u003chttp://ace.ajax.org\u003e\n   [node.js]: \u003chttp://nodejs.org\u003e\n   [Twitter Bootstrap]: \u003chttp://twitter.github.com/bootstrap/\u003e\n   [jQuery]: \u003chttp://jquery.com\u003e\n   [@tjholowaychuk]: \u003chttp://twitter.com/tjholowaychuk\u003e\n   [express]: \u003chttp://expressjs.com\u003e\n   [AngularJS]: \u003chttp://angularjs.org\u003e\n   [Gulp]: \u003chttp://gulpjs.com\u003e\n\n   [PlDb]: \u003chttps://github.com/joemccann/dillinger/tree/master/plugins/dropbox/README.md\u003e\n   [PlGh]: \u003chttps://github.com/joemccann/dillinger/tree/master/plugins/github/README.md\u003e\n   [PlGd]: \u003chttps://github.com/joemccann/dillinger/tree/master/plugins/googledrive/README.md\u003e\n   [PlOd]: \u003chttps://github.com/joemccann/dillinger/tree/master/plugins/onedrive/README.md\u003e\n   [PlMe]: \u003chttps://github.com/joemccann/dillinger/tree/master/plugins/medium/README.md\u003e\n   [PlGa]: \u003chttps://github.com/RahulHP/dillinger/blob/master/plugins/googleanalytics/README.md\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffooock%2Fphone-tracker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffooock%2Fphone-tracker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffooock%2Fphone-tracker/lists"}