Ejemplo n.º 1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sample);

    String clientId = ManifestUtils.getManifestData(this, "UberClientId");
    if (clientId.equals("insert_your_client_id_here")) {
      throw new IllegalArgumentException(
          "Please enter your client ID in client_id in res/values/strings.xml");
    }

    SignInButton uberButtonBlack = (SignInButton) findViewById(R.id.uber_button_black);
    RequestButton uberButtonWhite = (RequestButton) findViewById(R.id.uber_button_white);

    RideParameters rideParameters =
        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();

    uberButtonWhite.setRideParameters(rideParameters);
    // ---------------------------------------------------------

    Uber.getInstance().getRideHistory(0, 3);
  }
Ejemplo n.º 2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_test_uber_app);
    RelativeLayout layout = (RelativeLayout) findViewById(R.id.RelativeLayout);
    Session session =
        new Session.Builder()
            .setServerToken("maMItAGDV5HHqKAG3nLfLTlhMOnQscAONF_aeFcu")
            .setEnvironment(Session.Environment.SANDBOX)
            .build();
    UberRidesService service = UberRidesServices.createSync(session);
    final RequestButton requestButton = new RequestButton(this);
    location1 = getLocation();
    requestButton.setClientId("eFrzgz_2Du2KYUXIi3MKaNOWtxo3i77K");
    if (location1 != null) {

      RideParameters rideParams =
          new RideParameters.Builder()
              .setPickupLocation(
                  (float) location1.getLatitude(), (float) location1.getLongitude(), "", "")
              .build();
      requestButton.setRideParameters(rideParams);
    }

    layout.addView(requestButton);
  }