{"id":13645604,"url":"https://github.com/hzw1199/AndroidGpsStatus","last_synced_at":"2025-04-21T14:31:53.314Z","repository":{"id":157955088,"uuid":"87046403","full_name":"hzw1199/AndroidGpsStatus","owner":"hzw1199","description":"An android widget library to show GPS status and signal strength","archived":false,"fork":false,"pushed_at":"2020-09-04T02:52:21.000Z","size":2074,"stargazers_count":208,"open_issues_count":1,"forks_count":42,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-09T18:43:12.338Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hzw1199.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-04-03T06:55:21.000Z","updated_at":"2024-09-13T08:48:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"ab7fc07c-0828-41c8-84e8-be9c995c81f8","html_url":"https://github.com/hzw1199/AndroidGpsStatus","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hzw1199%2FAndroidGpsStatus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hzw1199%2FAndroidGpsStatus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hzw1199%2FAndroidGpsStatus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hzw1199%2FAndroidGpsStatus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hzw1199","download_url":"https://codeload.github.com/hzw1199/AndroidGpsStatus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250070229,"owners_count":21369840,"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":[],"created_at":"2024-08-02T01:02:38.277Z","updated_at":"2025-04-21T14:31:52.924Z","avatar_url":"https://github.com/hzw1199.png","language":"Java","readme":"# GPS Status\n[![](https://jitpack.io/v/hzw1199/AndroidGpsStatus.svg)](https://jitpack.io/#hzw1199/AndroidGpsStatus)\n\n[中文看这里](/READMEcn.md)  \n\n![](/media/anglerM4B30Xwuzongheng04042017015425.gif)\n\n# Download\nAdd it in your build.gradle at the end of repositories:  \n\n```\nallprojects {\n    repositories {\n        ...\n        maven { url \"https://jitpack.io\" }\n    }\n}\n```\n\nAdd the dependency in the form:  \n\n```\ndependencies {\n    compile 'com.github.hzw1199:AndroidGpsStatus:1.2'\n}\n```\n# Features\n\n* The layout of ```GpsStatusTextView``` and ```GpsStatusImageView``` are independent  \n* The color of ```GpsStatusTextView``` shows the status of GPS sensor: closed, fixed, unfixed  \n* The icon of ```GpsStatusImageView``` shows the status of GPS signal strength: closed, weak, medium, strong (through the number of satellites)  \n* Accurately make judgments while manual open and close the GPS  \n* Accurately make judgments while in the tunnel leading to the loss of GPS positioning  \n\n# Usage\n\n## Layout\n\n### GpsStatusTextView\n\n* Configure the ```GpsStatusTextView```  \n\n```xml\n\u003ccom.adam.gpsstatus.GpsStatusTextView\n    android:id=\"@+id/gpsText\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"48dp\"\n    android:text=\"GPS\"\n    android:textSize=\"24sp\"\n    android:textStyle=\"bold\"\n    android:gravity=\"center_vertical\"\n    app:colorClosed=\"@color/gps_icon_red\"\n    app:colorFixed=\"@color/gps_icon_green\"\n    app:colorUnFixed=\"@color/gps_icon_yellow\"/\u003e\n```\n* Configure xml attributes to set the text color of GPS status: closed, fixed, unfixed  \n\n| Attribute      | format        | describe  | default |\n| :---------: | :-------------: |:-------------:|:-------------:|\n| colorClosed|color|text color while GPS is closed|#F44336|\n| colorFixed |color|text color while GPS is fixed|#4CAF50|\n| colorUnFixed |color|text color while GPS is searching satellites|#F4B400|\n\n### GpsStatusImageView\n\n* Configure the ```GpsStatusImageView```  \n\n```xml\n\u003ccom.adam.gpsstatus.GpsStatusImageView\n    android:id=\"@+id/gpsImage\"\n    android:layout_width=\"48dp\"\n    android:layout_height=\"48dp\"\n    app:drawable0=\"@drawable/ic_gps_0_24dp\"\n    app:drawable1=\"@drawable/ic_gps_1_24dp\"\n    app:drawable2=\"@drawable/ic_gps_2_24dp\"\n    app:drawable3=\"@drawable/ic_gps_3_24dp\"\n    app:thr_1_2=\"4\"\n    app:thr_2_3=\"7\" /\u003e\n```\n* Configure xml attributes to set the drawable of GPS signal strength: closed, weak, medium, strong  \n* Configure xml attributes to set GPS signal strength weak - medium, medium - strong through the thresholds of satellite number, default thresholds are 4 and 7  \n\n| Attribute      | format        | describe  | default |\n| :---------: | :-------------: |:-------------:|:-------------:|\n| drawable0 | reference |drawable while GPS closed| ic_gps_0_24dp|\n| drawable1 | reference |drawable while GPS signal is weak| ic_gps_1_24dp|\n| drawable2 | reference |drawable while GPS signal is medium| ic_gps_2_24dp|\n| drawable3 | reference |drawable while GPS signal is strong| ic_gps_3_24dp|\n| thr_1_2 | integer |threshold of satellite number from weak to medium|4|\n| thr_2_3 | integer |threshold of satellite number from medium to strong|7|\n\n## Set Up\nYou only need to define ```GpsStatusTextView``` or ```GpsStatusImageView``` in layout, but still need to do the following in the code:\n\n* Permission  \nAdd permission in AndroidManifest.xml  \n\n```xml\n\u003cuses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" /\u003e\n```\n\n* Define  \n\n```java\nGpsStatusProxy proxy;\n```\n\n* Initialization  \nMake sure to have ```ACCESS_FINE_LOCATION``` permission before initialization\n\n```java\nproxy = GpsStatusProxy.getInstance(getApplicationContext());\nproxy.register();\n```\n\n* Call ```GpsStatusProxy.notifyLocation(android.location.Location)``` in location callback, for example:  \n\n```java\nLocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);\nlocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1, listener);\nLocationListener listener = new LocationListener() {\n    @Override\n    public void onLocationChanged(Location location) {\n        proxy.notifyLocation(location);\n    }\n\n    @Override\n    public void onStatusChanged(String provider, int status, Bundle extras) {\n\n    }\n\n    @Override\n    public void onProviderEnabled(String provider) {\n\n    }\n\n    @Override\n    public void onProviderDisabled(String provider) {\n\n    }\n};\n```\n\n* Destroy  \n  \n```java\nproxy.unRegister();\n```\n\n\n\n* If this project helps you, please star me.  \n\n## License\n\n```\nThe MIT License (MIT)\n\nCopyright (c) 2017 AndroidGpsStatus\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n```\n","funding_links":[],"categories":["其他"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhzw1199%2FAndroidGpsStatus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhzw1199%2FAndroidGpsStatus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhzw1199%2FAndroidGpsStatus/lists"}