rides-android-sdk
rides-android-sdk copied to clipboard
Ride Estimate not getting fetched on RideRequestButton
While setting RideParameters object, I set rideParams.setPickupToMyLocation() to avail the benefit of getting estimate from current device location to given drop off location, but the estimate is not getting refreshed.
Hey Ashwini,
You've identified a limitation of the ride request button and some poor documentation on our part. The pickup to my location is for when you deeplink into the Uber app. Currently the ride request button isn't able to use device location as part of it's estimates for pickup. Sounds like we should update our docs and look to add this functionality in an upcoming release.
I am not getting real time info on ride request button:
Find below my code :
SessionConfiguration configuration = new SessionConfiguration.Builder() .setRedirectUri(Constants.REDIRECT_URI) .setClientId(Constants.UBER_CLIENT_ID) .setServerToken(Constants.UBER_SERVER_TOKEN) .build();
UberSdk.initialize(configuration);
ServerTokenSession session = new ServerTokenSession(configuration);
RideParameters rideParametersForProduct = new RideParameters.Builder()
.setProductId(Constants.UBER_APP_ID)
.setPickupLocation(AppSingleton.getInstance().getCurrentLatitude(), AppSingleton.getInstance().getCurrentLongitude(), AppSingleton.getInstance().getCurrentLocationCity(), AppSingleton.getInstance().getCurrentAddress())
.setDropoffLocation(Double.parseDouble(latitude), Double.parseDouble(longitude), title, address)
.build();
RideRequestButton blackButton = (RideRequestButton) view.findViewById(R.id.uber_button_black);
blackButton.setRideParameters(rideParametersForProduct);
blackButton.setSession(session);
blackButton.setCallback(this);
blackButton.loadRideInformation();
In iphone they are getting realtime info but I didn't, Please help me on that.
Thanks
I had a similar problem of ride estimates not loading. I resolved it by adding a delay in setting the RideParameters, like this:
buttonContainerView.postDelayed(()->{
RideParameters rideParametersForProduct = ...
uberButton.setRideParameters(rideParametersForProduct);
uberButton.setSession(session);
uberButton.loadRideInformation();
}, 500L);
I think the UberButton may not be populating the estimates if it detects it is not attached to the Window. I am including the button in the footer of a ListView, and originally I was configuring the button in OnCreateView (ie, a few steps before it is added to the ListView via ListAdapter. Probably not the correct thing to do). Moving the button config to just before it is drawn by the ListView, and adding a delay of 500ms, seems to have worked.