{"id":16223693,"url":"https://github.com/lykmapipo/android-location-provider","last_synced_at":"2026-05-04T07:39:47.860Z","repository":{"id":139148226,"uuid":"194878681","full_name":"lykmapipo/android-location-provider","owner":"lykmapipo","description":"A pack of helpful helpers to obtain location(s) from fused location provider.","archived":false,"fork":false,"pushed_at":"2019-12-21T12:12:17.000Z","size":147,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-26T17:53:14.225Z","etag":null,"topics":["android","fused","gps","library","location","lykmapipo","provider"],"latest_commit_sha":null,"homepage":null,"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/lykmapipo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2019-07-02T14:24:26.000Z","updated_at":"2024-12-28T08:28:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"3518186c-0a56-40bf-9703-64089af9dfa0","html_url":"https://github.com/lykmapipo/android-location-provider","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykmapipo%2Fandroid-location-provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykmapipo%2Fandroid-location-provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykmapipo%2Fandroid-location-provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykmapipo%2Fandroid-location-provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lykmapipo","download_url":"https://codeload.github.com/lykmapipo/android-location-provider/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247761030,"owners_count":20991533,"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","fused","gps","library","location","lykmapipo","provider"],"created_at":"2024-10-10T12:19:46.435Z","updated_at":"2026-05-04T07:39:42.834Z","avatar_url":"https://github.com/lykmapipo.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"android-location-provider\n=========================\n\n[![](https://jitpack.io/v/lykmapipo/android-location-provider.svg)](https://jitpack.io/#lykmapipo/android-location-provider)\n\nA pack of helpful helpers to obtain location(s) from fused location provider.\n\n## Installation\nAdd [https://jitpack.io](https://jitpack.io) to your build.gradle with:\n```gradle\nallprojects {\n    repositories {\n        maven { url \"https://jitpack.io\" }\n    }\n}\n```\nadd `android-location-provider` dependency into your project\n\n```gradle\ndependencies {\n    implementtation 'com.github.lykmapipo:android-location-provider:v0.4.0'\n}\n```\n\n## Usage\n\nIn activity(or other component) request for last and location updates\n\n```java\npublic class MainActivity extends AppCompatActivity {\n\n    private static final String TAG = MainActivity.class.getSimpleName();\n    private TextView tvLongitude;\n    private TextView tvLatitude;\n    private TextView tvAddress;\n    private Location lastKnownLocation;\n\n    @SuppressLint(\"MissingPermission\")\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n\n        // request last known location\n        tvLongitude = findViewById(R.id.tvLongitude);\n        tvLatitude = findViewById(R.id.tvLatitude);\n        tvAddress = findViewById(R.id.tvAddress);\n        Button btnRequestLastLocation = findViewById(R.id.btnRequestLastLocation);\n        btnRequestLastLocation.setOnClickListener(v -\u003e LocationProvider.requestLastLocation(this, new LocationProvider.OnLastLocationListener() {\n            @Override\n            public void onSuccess(Location location) {\n                Toast.makeText(MainActivity.this, \"Location Success: \" + location.toString(), Toast.LENGTH_SHORT).show();\n                lastKnownLocation = location;\n                double longitude = location.getLongitude();\n                double latitude = location.getLatitude();\n                tvLatitude.setText(format(\"Latitude\", latitude));\n                tvLongitude.setText(format(\"Longitude\", longitude));\n            }\n\n            @Override\n            public void onFailure(Exception error) {\n                Toast.makeText(MainActivity.this, \"Location Failed: \" + error.getMessage(), Toast.LENGTH_SHORT).show();\n            }\n        }));\n\n        // request address\n        Button btnRequestAddress = findViewById(R.id.btnRequestAddress);\n        btnRequestAddress.setOnClickListener(v -\u003e {\n            if (lastKnownLocation != null) {\n                LocationProvider.requestAddress(this, lastKnownLocation, new LocationProvider.OnAddressListener() {\n\n                    @Override\n                    public void onSuccess(Address address) {\n                        Toast.makeText(MainActivity.this, \"Address Success: \" + address.toString(), Toast.LENGTH_SHORT).show();\n                        tvAddress.setText(format(\"Address\", address.getAdminArea(), address.getCountryName()));\n                    }\n\n                    @Override\n                    public void onFailure(Exception error) {\n                        Toast.makeText(MainActivity.this, \"Address Failed: \" + error.getMessage(), Toast.LENGTH_SHORT).show();\n                    }\n                });\n            }\n        });\n\n        // request location updates\n        Button btnRequestLocationUpdates = findViewById(R.id.btnRequestLocationUpdates);\n        btnRequestLocationUpdates.setOnClickListener(v -\u003e LocationProvider.requestLocationUpdates(this, new LocationProvider.OnLocationUpdatesListener() {\n            @Override\n            public void onSuccess(LocationResult result) {\n                // obtain latest location\n                Location location = result.getLastLocation();\n\n                Toast.makeText(MainActivity.this, \"Location Updates Success: \" + location.toString(), Toast.LENGTH_SHORT).show();\n                double longitude = location.getLongitude();\n                double latitude = location.getLatitude();\n                tvLatitude.setText(format(\"Latitude\", latitude));\n                tvLongitude.setText(format(\"Longitude\", longitude));\n            }\n\n            @Override\n            public void onFailure(Exception error) {\n                Toast.makeText(MainActivity.this, \"Location Updates Failed: \" + error.getMessage(), Toast.LENGTH_SHORT).show();\n            }\n        }));\n\n        // stop location updates\n        Button btnStopLocationUpdates = findViewById(R.id.btnStopLocationUpdates);\n        btnStopLocationUpdates.setOnClickListener(view -\u003e {\n            LocationProvider.stopLocationUpdates();\n            Toast.makeText(MainActivity.this, \"Location Updates Stopped Successfully\", Toast.LENGTH_SHORT).show();\n\n        });\n    }\n\n    @Override\n    protected void onPause() {\n        super.onPause();\n        LocationProvider.stopLocationUpdates();\n    }\n\n    private String format(@NonNull String label, @NonNull double value) {\n        return String.format(Locale.ENGLISH, \"%s: %f\", label, value);\n    }\n\n    private String format(@NonNull String label, @NonNull String... value) {\n        String s = TextUtils.join(\", \", value);\n        return String.format(Locale.ENGLISH, \"%s: %s\", label, s);\n    }\n}\n```\n\n\n## Test\n```sh\n./gradlew test\n```\n\n## Contribute\nIt will be nice, if you open an issue first so that we can know what is going on, then, fork this repo and push in your ideas.\nDo not forget to add a bit of test(s) of what value you adding.\n\n## License\n\n(The MIT License)\n\nCopyright (c) lykmapipo \u0026\u0026 Contributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flykmapipo%2Fandroid-location-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flykmapipo%2Fandroid-location-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flykmapipo%2Fandroid-location-provider/lists"}