こんにちは、Ride を APP の Uber ボタンと統合したいと考えています。パラメータを使用してAPIにgetリクエストを作成しました
'server_token': 'ma***********************u',
'start_latitude',
'start_longitude',
'end_latitude'
'end_longitude'.
そして、私は応答を得ました:
{
"result": {
"prices": [
{
"currency_code": "INR",
"display_name": "uberGO",
"distance": 18.45,
"duration": 3503,
"estimate": "₹559-720",
"high_estimate": 720,
"localized_display_name": "uberGO",
"low_estimate": 559,
"minimum": 60,
"product_id": "c8170d76-b67c-44b1-8c26-5f45541434d2",
"surge_multiplier": 2
},
{
"currency_code": "INR",
"display_name": "uberGO",
"distance": 18.45,
"duration": 3503,
"estimate": "₹559-719",
"high_estimate": 719,
"localized_display_name": "uberGO",
"low_estimate": 559,
"minimum": 60,
"product_id": "bc46ccfe-de64-4cad-b63a-7cf48e649a3e",
"surge_multiplier": 2
},
{
"currency_code": "INR",
"display_name": "uberX",
"distance": 18.45,
"duration": 3503,
"estimate": "₹834-1,069",
"high_estimate": 1069,
"localized_display_name": "uberX",
"low_estimate": 834,
"minimum": 80,
"product_id": "4da6a747-e0be-4f56-a3c7-3f30f22bf86d",
"surge_multiplier": 2.4
},
{
"currency_code": "INR",
"display_name": "uberGO",
"distance": 18.45,
"duration": 3503,
"estimate": "₹834-1,069",
"high_estimate": 1069,
"localized_display_name": "uberGO",
"low_estimate": 834,
"minimum": 80,
"product_id": "18656d0e-cc1b-4aa6-8146-92e605626caa",
"surge_multiplier": 2.4
},
{
"currency_code": "INR",
"display_name": "uberXL",
"distance": 18.45,
"duration": 3503,
"estimate": "₹1,646-2,099",
"high_estimate": 2099,
"localized_display_name": "uberXL",
"low_estimate": 1646,
"minimum": 125,
"product_id": "2ea18da2-bcf0-4df7-a7b8-a827e9945322",
"surge_multiplier": 3.4
},
{
"currency_code": "INR",
"display_name": "uberXL",
"distance": 18.45,
"duration": 3503,
"estimate": "₹1,646-2,099",
"high_estimate": 2099,
"localized_display_name": "uberXL",
"low_estimate": 1646,
"minimum": 125,
"product_id": "a4404842-e40a-471b-a7a5-13da3551e94f",
"surge_multiplier": 3.4
}
]
}
}
ボタンの onclicklisteners に次のコードを追加しました。
String uri = "uber://?client_id=eFrzgz_2Du2KYUXIi3MKaNOWtxo3i77K&action=setPickup&pickup[latitude]=37.775818&pickup[longitude]=-122.418028&pickup[nickname]=UberHQ&pickup[formatted_address]=1455%20Market%20St%2C%20San%20Francisco%2C%20CA%2094103&dropoff[latitude]=37.802374&dropoff[longitude]=-122.405818&dropoff[nickname]=Coit%20Tower&dropoff[formatted_address]=1%20Telegraph%20Hill%20Blvd%2C%20San%20Francisco%2C%20CA%2094133&product_id=a1111c8c-c720-46c3-8534-2fcdd730040d";
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(uri));
startActivity(intent);
これらのボタンをクリックすると、ボタンは正しい src と dst を使用して uber APP にリダイレクトされますが、UberX、UberGo、UberL などの正しい uber カテゴリを選択していません。常にデフォルトのカテゴリが選択されます。ユーザーがボタンを 1 つクリックするだけでタクシーを予約できるようにカスタマイズする方法。