我正在尝试将RideRequestButton
功能添加到我的android应用中,我希望它通过按钮更新估算值,但是由于某些原因,该功能仅在使用与美国相关的地址/坐标时显示。
仅在美国支持吗?
这是我的代码:
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();
}
}
另外,SANDBOX真的可以与此SDK一起使用吗?