{"id":25874656,"url":"https://github.com/lyft/lyft-android-sdk","last_synced_at":"2025-07-11T08:03:35.840Z","repository":{"id":10835952,"uuid":"67075821","full_name":"lyft/lyft-android-sdk","owner":"lyft","description":"Public Lyft SDK for Android","archived":false,"fork":false,"pushed_at":"2023-03-20T01:56:28.000Z","size":227,"stargazers_count":72,"open_issues_count":7,"forks_count":26,"subscribers_count":428,"default_branch":"master","last_synced_at":"2023-07-28T17:39:20.337Z","etag":null,"topics":["lyft"],"latest_commit_sha":null,"homepage":"https://www.lyft.com/developers","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lyft.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2016-08-31T21:47:25.000Z","updated_at":"2023-05-30T19:16:44.000Z","dependencies_parsed_at":"2022-08-07T06:00:40.690Z","dependency_job_id":null,"html_url":"https://github.com/lyft/lyft-android-sdk","commit_stats":null,"previous_names":[],"tags_count":7,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyft%2Flyft-android-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyft%2Flyft-android-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyft%2Flyft-android-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyft%2Flyft-android-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lyft","download_url":"https://codeload.github.com/lyft/lyft-android-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241485250,"owners_count":19970450,"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":["lyft"],"created_at":"2025-03-02T09:28:39.079Z","updated_at":"2025-03-02T09:28:39.749Z","avatar_url":"https://github.com/lyft.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lyft Android SDK\n\nThe Official Lyft Android SDK makes it easy to integrate Lyft into your app. More specifically, it provides:\n- An easily configurable Lyft button which can display cost, ETA, and ride type. Tapping the button deeplinks into the Lyft app with pre-filled pickup/destination/ridetype.\n- A Java interface for making sync/async calls to Lyft's REST APIs\n- Two sample Android Activities that show how to use the SDK components.\n\n## Registration\n- You must first create a Lyft Developer account [here](https://www.lyft.com/developers).\n- Once registered, you will be assigned a Client ID and will be able to generate Client Tokens.\n\n## Setup and Installation\n\n### Gradle:\n\n```gradle\nrepositories {\n  mavenCentral() // or jcenter()\n}\n\ndependencies {\n    compile 'com.lyft:lyft-android-sdk:2.0.2'\n}\n```\n\nIf you only want to use the [Lyft API Wrapper](https://github.com/lyft/lyft-android-sdk#lyft-api-wrapper) or [Deeplink](https://github.com/lyft/lyft-android-sdk#deeplinking) portion of the SDK, you can pull them individually.\n```gradle\ncompile 'com.lyft:lyft-android-sdk-networking:2.0.2'  // Lyft API Wrapper\ncompile 'com.lyft:lyft-android-sdk-deeplink:2.0.2'    // Deeplink\n```\n\n### Maven:\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.lyft\u003c/groupId\u003e\n  \u003cartifactId\u003elyft-android-sdk\u003c/artifactId\u003e\n  \u003cversion\u003e2.0.2\u003c/version\u003e\n  \u003ctype\u003eaar\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\n## Lyft Button\n\nAdding the Lyft Button in an XML layout is as simple as:\n```xml\n\u003ccom.lyft.lyftbutton.LyftButton\n    android:id=\"@+id/lyft_button\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\"\n    lyft:lyftStyle=\"lyftMulberryDark\"\n    /\u003e\n```\nWe recommend setting the width/height to `wrap_content`, which results in a width of 260dp and a height of 50dp.\nOtherwise, please keep in mind that a smaller width/height may result in undesirable UI, such as overlapping text.\n\nTo load ETA/cost:\n```java\nApiConfig apiConfig = new ApiConfig.Builder()\n        .setClientId(\"your_client_id\")\n        .setClientToken(\"your_client_token\")\n        .build();\n\nLyftButton lyftButton = (LyftButton) findViewById(R.id.lyft_button);\nlyftButton.setApiConfig(apiConfig);\n\nRideParams.Builder rideParamsBuilder = new RideParams.Builder()\n        .setPickupLocation(37.7766048, -122.3943576)\n        .setDropoffLocation(37.759234, -122.4135125);\nrideParamsBuilder.setRideTypeEnum(RideTypeEnum.STANDARD);\n\nlyftButton.setRideParams(rideParamsBuilder.build());\nlyftButton.load();\n```\n\nAddresses can also be used for pickup/dropoff locations. Each address results in an extra API call to obtain the corresponding lat/lng pair. Therefore, we recommend using lat/lng values directly if they are available. \n```java\nRideParams.Builder rideParamsBuilder = new RideParams.Builder()\n        .setPickupAddress(\"185 Berry St, San Francisco, CA 94107\")\n        .setDropoffAddress(\"2300 Harrison St, San Francisco, CA 94110\");\n```\n\n### Ride types\nLyft is growing very quickly and is currently available in [these cities](https://www.lyft.com/cities). Please keep in mind that some ride types (such as Lyft Line) are not yet available in all Lyft cities. If you set the ride type of the button  and it happens to be unavailable, the button will default to the Lyft Standard ride type. You can utilize the [`/v1/ridetypes`](https://developer.lyft.com/docs/availability-ride-types) endpoint to get a list of the available ride types in an area.\n\n### Button styles\nTo specify the button style via XML, use the `lyft:lyftStyle` attribute or set it programmatically:\n```java\nlyftButton.setStyle(LyftStyle.MULBERRY_DARK);\n```\n\nThere are 5 styles to pick from:\n\n![lyft-styles](https://cloud.githubusercontent.com/assets/13209348/17683300/88f86446-6306-11e6-81e6-bc42fc77650e.png)\n\n## Lyft API Wrapper\nThe SDK provides wrapper methods around Lyft's REST APIs - this can be helpful when you want to build a more custom integration with the Lyft platform vs making HTTP requests directly.\n\nThe SDK uses Square's [Retrofit 2](http://square.github.io/retrofit/) networking library. For each Lyft API endpoint, there is a corresponding Java method. The return type is a `Call` object which can be executed synchronously or asynchronously. See [LyftApi.java](https://github.com/lyft/lyft-android-sdk/blob/master/networking/src/main/java/com/lyft/networking/apis/LyftApi.java) for all the API methods.\n\n```java\nLyftApi lyftPublicApi = new LyftApiFactory(apiConfig).getLyftApi();\nCall\u003cEtaEstimateResponse\u003e etaCall = lyftPublicApi.getEtas(37.7766048, -122.3943576, \"lyft\");\n```\nAsynchronous:\n```java\netaCall.enqueue(new Callback\u003cEtaEstimateResponse\u003e() {\n    @Override\n    public void onResponse(Call\u003cEtaEstimateResponse\u003e call, Response\u003cEtaEstimateResponse\u003e response) {\n        EtaEstimateResponse etaEstimateResponse = response.body();\n        Eta eta = etaEstimateResponse.eta_estimates.get(0);\n    }\n\n    @Override\n    public void onFailure(Call\u003cEtaEstimateResponse\u003e call, Throwable t) {\n        Log.d(\"MyApp\", t.toString());\n    }\n});\n```\n\nSynchronous:\n```java\nEtaEstimateResponse etaEstimateResponse = etaCall.execute().body();\nEta eta = etaEstimateResponse.eta_estimates.get(0);\n```\n\n### RxJava Observables\nIf you already use RxJava (your app must have it as a dependency), then you can obtain an `Observable` instead of a `Call` object. Simply use [LyftApiRx](https://github.com/lyft/lyft-android-sdk/blob/master/networking/src/main/java/com/lyft/networking/apis/LyftApiRx.java) instead of LyftApi.\n\n```java\nLyftPublicApiRx lyftPublicApiRx = new LyftApiFactory(apiConfig).getLyftPublicApiRx();\nObservable\u003cEtaEstimateResponse\u003e etaObservable = lyftPublicApiRx.getEtas(37.7766048, -122.3943576, \"lyft\");\n```\n\n### ProGuard\nIf you are directly using the Lyft Wrapper API without using the `Lyft Button`, then you may need to add the the ProGuard rules for Retrofit. Please see [proguard-rules.pro](https://github.com/lyft/lyft-android-sdk/blob/master/lyft-button/proguard-rules.pro). This only applies if you are using ProGuard.\n\n## Deeplinking\nThe SDK provides direct [deeplinking](https://developer.lyft.com/docs/deeplinking) to the Lyft app for those developers who prefer to handle their own custom deeplinking vs relying on the Lyft Button.. The `deeplink` module of the SDK includes this logic and makes it easy to launch the Lyft app.\n```java\nDeepLinkParams deepLinkParams = new DeepLinkParams.Builder()\n        .setClientId(\"your_client_id\")\n        .setRideType(RideTypeEnum.SHARED)\n        .setPickupLocation(37.7766048, -122.3943576)\n        .setDropoffLocation(37.759234, -122.4135125)\n        .build();\n\nDeepLink.launchLyftApp(getContext(), deepLinkParams);\n```\n\n## Sample Activities\nCheckout the sample activites which are included in the SDK, in the `sample-app` module:\n  - `SampleBasicActivity`: Includes minimal code to set up the Lyft Button.\n  - `SampleLocationAwareActivity`: Gets the device's current GPS location and calls the `/v1/ridetypes` endpoint to get a list of the available ride types in the area (i.e. Lyft Line, Lyft Plus, etc). The user is able to select an available ride type via a dropdown. The Lyft Button then displays the current ETA and cost of that ride type to a specified destination.\n\nYou can specify which activity to launch in the `sample-app`'s [AndroidManifest.xml](https://github.com/lyft/lyft-android-sdk/blob/master/sample-app/src/main/AndroidManifest.xml).\n\n## Support\n\nIf you're looking for help configuring or using the SDK, or if you have general questions related to our APIs, the Lyft Developer Platform team provides support through our [forum](https://developer.lyft.com/discuss) as well as on Stack Overflow (using the `lyft-api` tag)\n\n## Reporting security vulnerabilities\n\nIf you've found a vulnerability or a potential vulnerability in the Lyft Android SDK,\nplease let us know at security@lyft.com. We'll send a confirmation email to\nacknowledge your report, and we'll send an additional email when we've\nidentified the issue positively or negatively.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flyft%2Flyft-android-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flyft%2Flyft-android-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flyft%2Flyft-android-sdk/lists"}