{"id":30218438,"url":"https://github.com/yelp/yelp-android","last_synced_at":"2025-08-14T06:35:43.928Z","repository":{"id":57729890,"uuid":"45434028","full_name":"Yelp/yelp-android","owner":"Yelp","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-24T11:07:03.000Z","size":298,"stargazers_count":56,"open_issues_count":6,"forks_count":34,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-03-12T22:35:49.922Z","etag":null,"topics":["android","api-client"],"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/Yelp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-11-03T01:39:27.000Z","updated_at":"2024-12-19T10:23:54.000Z","dependencies_parsed_at":"2022-09-11T06:20:44.114Z","dependency_job_id":"298e1fb2-d3a8-43cd-b28f-fdbf96936031","html_url":"https://github.com/Yelp/yelp-android","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Yelp/yelp-android","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yelp%2Fyelp-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yelp%2Fyelp-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yelp%2Fyelp-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yelp%2Fyelp-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yelp","download_url":"https://codeload.github.com/Yelp/yelp-android/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yelp%2Fyelp-android/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270377874,"owners_count":24573416,"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","status":"online","status_checked_at":"2025-08-14T02:00:10.309Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","api-client"],"created_at":"2025-08-14T06:35:28.996Z","updated_at":"2025-08-14T06:35:43.887Z","avatar_url":"https://github.com/Yelp.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/Yelp/yelp-android.svg?branch=master)](https://travis-ci.org/Yelp/yelp-android)\n\n# yelp-android\nAn Android library for the [Yelp API v2](https://www.yelp.com/developers/documentation/v2/overview). It simplifies the \nprocess of authentication, request construction, and response parsing for Android developers using the \n[Yelp API v2](https://www.yelp.com/developers/documentation/v2/overview). This clientlib has been tested with \napplications written in Android API level 15 and 25.\n\n## Installation\n\nDownload [the latest AAR](https://search.maven.org/remote_content?g=com.yelp.clientlib\u0026a=yelp-android\u0026v=LATEST) or \ninstall by using [Maven](https://maven.apache.org/):\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.yelp.clientlib\u003c/groupId\u003e\n  \u003cartifactId\u003eyelp-android\u003c/artifactId\u003e\n  \u003cversion\u003e3.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nor [Gradle](http://gradle.org/):\n\n```groovy\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n    ...\n    compile 'com.yelp.clientlib:yelp-android:3.0.0'\n    ...\n}\n```\nProguard rules for the library can be found [here](https://github.com/Yelp/yelp-android/blob/master/proguard-rules.pro)\n\n## Usage\n\n### Basic usage\nThis library uses a `YelpAPI` object to query against the API. Instantiate a `YelpAPI` object by using \n`YelpAPIFactory` with your API keys.\n```java\nYelpAPIFactory apiFactory = new YelpAPIFactory(consumerKey, consumerSecret, token, tokenSecret);\nYelpAPI yelpAPI = apiFactory.createAPI();\n```\n\n### [Search API](http://www.yelp.com/developers/documentation/v2/search_api)\nOnce you have a `YelpAPI` object you can use the `search` function to generate a `Call` object which makes a request to \nthe Search API.\n\nThe general params and locale options should be passed to the method as a `Map\u003cString, String\u003e`. The full list of \nparameters can be found in the [Search API Documentation](https://www.yelp.com/developers/documentation/v2/search_api).\n```java\nMap\u003cString, String\u003e params = new HashMap\u003c\u003e();\n\n// general params\nparams.put(\"term\", \"food\");\nparams.put(\"limit\", \"3\");\n\n// locale params\nparams.put(\"lang\", \"fr\");\n\nCall\u003cSearchResponse\u003e call = yelpAPI.search(\"San Francisco\", params);\n```\n\nNow you can execute the `Call` object to send the request.\n```java\nResponse\u003cSearchResponse\u003e response = call.execute();\n```\n\nYou can also pass in a `Callback` object to send the request asynchronously. For more see [Asynchronous Requests](#asynchronous-requests) section.\n```java\nCallback\u003cSearchResponse\u003e callback = new Callback\u003cSearchResponse\u003e() {\n    @Override\n    public void onResponse(Call\u003cSearchResponse\u003e call, Response\u003cSearchResponse\u003e response) {\n        SearchResponse searchResponse = response.body();\n        // Update UI text with the searchResponse.\n    }\n    @Override\n    public void onFailure(Call\u003cSearchResponse\u003e call, Throwable t) {\n        // HTTP error happened, do something to handle it.\n    }\n};\n\ncall.enqueue(callback);\n```\n\nAdditionally there are two more search methods for searching by a [bounding box](https://www.yelp.com/developers/documentation/v2/search_api#searchGBB) or for [geographical coordinates](https://www.yelp.com/developers/documentation/v2/search_api#searchGC):\n```java\n// bounding box\nBoundingBoxOptions bounds = BoundingBoxOptions.builder()\n        .swLatitude(37.7577)\n        .swLongitude(-122.4376)\n        .neLatitude(37.785381)\n        .neLongitude(-122.391681).build();\nCall\u003cSearchResponse\u003e call = yelpAPI.search(bounds, params);\nResponse\u003cSearchResponse\u003e response = call.execute();\n\n// coordinates\nCoordinateOptions coordinate = CoordinateOptions.builder()\n        .latitude(37.7577)\n        .longitude(-122.4376).build();\nCall\u003cSearchResponse\u003e call = yelpAPI.search(coordinate, params);\nResponse\u003cSearchResponse\u003e response = call.execute();\n```\n\n### [Business API](http://www.yelp.com/developers/documentation/v2/business)\nTo query the Business API, use the `getBusiness` function with a `business_id`. You can also pass in locale parameters \nin a `Map\u003cString, String\u003e` as specified in the [Business API Documentation](http://www.yelp.com/developers/documentation/v2/business).\n```java\nCall\u003cBusiness\u003e call = yelpAPI.getBusiness(\"yelp-san-francisco\");\nResponse\u003cBusiness\u003e response = call.execute();\n```\nYou can pass in locale information as well.\n```java\nMap\u003cString, String\u003e params = new HashMap\u003c\u003e();\nparams.put(\"lang\", \"fr\");\n\nCall\u003cBusiness\u003e call = yelpAPI.getBusiness(\"yelp-san-francisco\", params);\nResponse\u003cBusiness\u003e response = call.execute();\n```\n\n### [Phone Search API](http://www.yelp.com/developers/documentation/v2/phone_search)\nTo query the Phone Search API, use the `getPhoneSearch` function with a phone number. Additional parameters can be\npassed in by using a `Map\u003cString, String\u003e` as specified in the [Phone Search API Documentation](https://www.yelp.com/developers/documentation/v2/phone_search).\n```java\nCall\u003cSearchResponse\u003e call = yelpAPI.getPhoneSearch(\"+15555555555\");\nResponse\u003cSearchResponse\u003e response = call.execute();\n```\nYou can pass in country code information as well\n```java\nMap\u003cString, String\u003e params = new HashMap\u003c\u003e();\nparams.put(\"cc\", \"US\");\nparams.put(\"category\", \"fashion\");\n\nCall\u003cSearchResponse\u003e call = yelpAPI.getPhoneSearch(\"5555555555\", params);\nResponse\u003cSearchResponse\u003e response = call.execute();\n```\n\n### Asynchronous Requests\nThis library uses [Retrofit](http://square.github.io/retrofit/) as the HTTP client. To send a request asynchronously,\nuse `Call.enqueue()` to set `Callback` function for an asynchronous request.\n```java\nCallback\u003cBusiness\u003e callback = new Callback\u003cBusiness\u003e() {\n    @Override\n    public void onResponse(Call\u003cBusiness\u003e call, Response\u003cBusiness\u003e response) {\n        Business business = response.body();\n        // Update UI text with the Business object.\n    }\n    @Override\n    public void onFailure(Call\u003cBusiness\u003e call, Throwable t) {\n        // HTTP error happened, do something to handle it.\n    }\n};\n\nCall\u003cBusiness\u003e call = yelpAPI.getBusiness(businessId);\ncall.enqueue(callback);\n```\n\nYou can cancel asynchronous requests by simply call `cancel()` on `Call` objects. It is important to cancel your calls \nwhile your `Activity` is being destroyed to avoid memory leaks.\n```java\nCall\u003cBusiness\u003e call = yelpAPI.getBusiness(businessId);\ncall.enqueue(callback);\n\n// Activity is being destroyed and the call should be canceled.\ncall.cancel();\n```\n\nFor more information about the usage of asynchronous requests in Retrofit, see [Retrofit documentation](http://square.github.io/retrofit/).\n\n## Responses\nAfter `Call` object is executed, a `Response` contains parsed Java objects will be returned, use `Response.body()` to \nget parsed Java objects.\n\nSearch and phone search responses are parsed into `SearchResponse` objects.\n```java\nCall\u003cSearchResponse\u003e call = yelpAPI.search(\"San Francisco\", params);\nSearchResponse searchResponse = call.execute().body();\n\nint totalNumberOfResult = searchResponse.total();  // 3\n\nArrayList\u003cBusiness\u003e businesses = searchResponse.businesses();\nString businessName = businesses.get(0).name();  // \"JapaCurry Truck\"\nDouble rating = businesses.get(0).rating();  // 4.0\n```\n\nBusiness responses are parsed into `Business` objects directly.\n```java\nCall\u003cBusiness\u003e call = yelpAPI.business(\"japacurry-truck-san-francisco\");\nResponse\u003cBusiness\u003e response = call.execute();\nBusiness business = response.body();\n\nString businessName = business.name();  // \"JapaCurry Truck\"\nDouble rating = business.rating();  // 4.0\n```\n\nFor a full list of available response fields, take a look at the [documentation](https://www.yelp.com/developers/documentation/v2/overview) \nor the classes defined in [com.yelp.clientlib.entities](../../tree/master/src/main/java/com/yelp/clientlib/entities).\n\n## Contributing\n1. Fork it (http://github.com/yelp/yelp-android/fork)\n2. Create your feature branch (git checkout -b my-new-feature)\n3. Commit your changes (git commit -am 'Add some feature')\n4. Push to the branch (git push origin my-new-feature)\n5. Create new Pull Request\n\n## Testing\nPlease write tests for any new features. We use JUnit + Gradle so just run `./gradlew test` to run the full test suite.\nTo know more about running JUnit tests in Gradle, see [Gradle: The Java Plugin - Test](https://docs.gradle\n.org/current/userguide/java_plugin.html#sec:java_test).\n\nIf you are adding a new integration test, you will need to connect to the Yelp API. You can set this up by putting \nyour API keys into `src/integration-test/resources/credentials.yaml` in the following format:\n```\nconsumer_key: YOUR_CONSUMER_KEY\nconsumer_secret: YOUR_CONSUMER_SECRET\ntoken: YOUR_TOKEN\ntoken_secret: YOUR_TOKEN_SECRET\n```\n\nTo run the integration tests, execute `./gradlew integrationTest`. Integration tests will not be ran in the build\nprocess by executing `./gradlew build`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyelp%2Fyelp-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyelp%2Fyelp-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyelp%2Fyelp-android/lists"}