In previous versions of the Uber Rides SDK there was a simple way to embed the Uber rider experience in your application with the Ride Request Widget but now it has been deprecated.
My code is:
SessionConfiguration config = new SessionConfiguration.Builder()
.setClientId("<MY_CLIENT_ID>")
.setClientSecret("<MY_CLIENT_SECRET>")
.setServerToken("<MY_SERVER_TOKEN>")
.build();
RideParameters rideParams = new RideParameters.Builder()
.setProductId("a1111c8c-c720-46c3-8534-2fcdd730040d")
.setPickupLocation(37.775304, -122.417522, "Uber HQ", "1455 Market Street,
San Francisco, California")
.setDropoffLocation(37.795079, -122.4397805, "Embarcadero", "One Embarcadero
Center, San Francisco")
.build();
RideRequestDeeplink deeplink = new RideRequestDeeplink.Builder(context)
.setSessionConfiguration(config)
.setRideParameters(rideParams)
.build();
deeplink.execute();
Previously the app was working just fine.
I want some work round or code snippet which will help me achieve the same functionality and migrate to meet the new rules as per Uber latest release. Thanks in advance
There were some changes to the latest version of the Uber SDK for Android (v0.9.0) - it was added support for Uber Mobile Web as Fallback option over deprecated Ride Request Widget. You can check our documentation and deep links guide here: https://developer.uber.com/docs/riders/ride-requests/tutorials/deep-links/introduction#android.
You can see there an example to just get the uri (.getUri()) and then open it in a chrometab/Browser etc if Uber is not installed (or call .execute() to open in default app/browser):
SessionConfiguration config = new SessionConfiguration.Builder()
.setClientId("<CLIENT_ID>")
.setClientSecret("<CLIENT_SECRET>")
.setServerToken("<SERVER_TOKEN>")
.build();
RideRequestDeeplink deeplink = new RideRequestDeeplink.Builder(context)
.setSessionConfiguration(config)
.setFallback(Deeplink.Fallback.MOBILE_WEB)
.setRideParameters(rideParams)
.build();
// to launch as a custom tab with browser fallback
deeplink.execute();
// to get the mobile deep link as a string
String uri = deeplink.getUri();