I'm trying to add the RideRequestButton
feature to my android app, I want it to update the estimates through the button but for some reason this only displays when I use US-related addresses/coordinates.
Is this only supported in US?
Here's my code:
public class SampleActivity extends AppCompatActivity {
private RideRequestButton requestButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);
// Colombia
// RideParameters rideParams = new RideParameters.Builder()
// .setPickupLocation(4.720431, -74.041871, "George M.", "Ak. 15 #136-45, Bogotá, Colombia")
// .setDropoffLocation(4.732878, -74.054728, "Home s", "Cl. 150 #53-28, Bogotá, Colombia")
// .setProductId("a1111c8c-c720-46c3-8534-2fcdd730040d")
// .build();
// US
RideParameters rideParams = new RideParameters.Builder()
.setPickupLocation(37.775304, -122.417522, "Uber HQ", "1455 Market Street, San Francisco")
.setDropoffLocation(37.795079, -122.4397805, "Embarcadero", "One Embarcadero Center, San Francisco") // Price estimate will only be provided if this is provided.
.setProductId("a1111c8c-c720-46c3-8534-2fcdd730040d") // Optional. If not provided, the cheapest product will be used.
.build();
SessionConfiguration config = new SessionConfiguration.Builder()
.setClientId("---")
.setServerToken("---")
.setEnvironment(SessionConfiguration.Environment.SANDBOX)
.build();
ServerTokenSession session = new ServerTokenSession(config);
RideRequestButtonCallback callback = new RideRequestButtonCallback() {
@Override
public void onRideInformationLoaded() {
}
@Override
public void onError(ApiError apiError) {
}
@Override
public void onError(Throwable throwable) {
}
};
requestButton = findViewById(R.id.uber_button_black);
requestButton.setRideParameters(rideParams);
requestButton.setSession(session);
requestButton.setCallback(callback);
requestButton.loadRideInformation();
}
}
Also, does SANDBOX really work with this SDK?
from Uber RideRequestButton not displaying estimates for countries other than US
No comments:
Post a Comment