Search code examples
androiduber-api

Uber RideRequestButton gets stuck at "Requesting"


I am implementing the RideRequestButton to open up the UBER activity to request cabs which is provided by the UBER SDK. After selecting the source and destination when I click the "request uberx" button it shows "requesting" but nothing happens after that.

The sample code works fine but the same code is not working in my app. I have set the CLIENT_ID,REDIRECT_URI and SERVER_TOKEN and also given the location permission in Mainfest. I also have the FULL ACCESS permission from UBER.

Here is my code snippet

    configuration = new SessionConfiguration.Builder()
            .setRedirectUri(REDIRECT_URI)
            .setClientId(CLIENT_ID)
            .setServerToken(SERVER_TOKEN)
            .build();
    validateConfiguration(configuration);

    ServerTokenSession session = new ServerTokenSession(configuration);

    RideParameters rideParametersForProduct = new RideParameters.Builder()
            .setProductId(UBERX_PRODUCT_ID)
            .setPickupLocation(PICKUP_LAT, PICKUP_LONG, PICKUP_NICK, PICKUP_ADDR)
            .setDropoffLocation(DROPOFF_LAT, DROPOFF_LONG, DROPOFF_NICK, DROPOFF_ADDR)
            .build();

    RideRequestButton uberButtonWhite = new RideRequestButton(context);
    RideRequestActivityBehavior rideRequestActivityBehavior = new RideRequestActivityBehavior((Activity)context,
            WIDGET_REQUEST_CODE, configuration);
    uberButtonWhite.setRequestBehavior(rideRequestActivityBehavior);
    uberButtonWhite.setRideParameters(rideParametersForProduct);
    uberButtonWhite.setSession(session);
    uberButtonWhite.loadRideInformation();

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setView(uberButtonWhite);
    builder.show();

Is there something else that I need to do to make it work?

Snapshot


Solution

  • I am answering my own question. The hint by @tsmith worked for me. The environment has to be explicitly set to Production. Keeping it sandbox or blank would make the application freeze at "requesting".