GoogleMaps Directions Api

时间:2019-06-18 06:08:36

标签: android firebase api google-maps maps

我需要有关GoogleMaps Api的帮助。 我在Google Clouds Api中启用了凭据,并启用了计费,但是,当我的应用程序请求“ Directions Api”时,它会显示以下消息:“您必须使用api密钥来验证对Google Maps Platform api的每个请求”。我需要帮助。谢谢!

我已经激活了帐单

private void getRideInformation() {
    historyRideInfoDb.addListenerForSingleValueEvent(new ValueEventListener() {
        @SuppressLint("SetTextI18n")
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            if(dataSnapshot.exists()){
                for (DataSnapshot child:dataSnapshot.getChildren()){
                    if (child.getKey().equals("customer")){
                        customerId = child.getValue().toString();
                        if(!customerId.equals(currentUserId)){
                            userDriverOrCustomer = "Drivers";
                            getUserInformation("Customers", customerId);
                        }
                    }
                    if (child.getKey().equals("driver")){
                        driverId = child.getValue().toString();
                        if(!driverId.equals(currentUserId)){
                            userDriverOrCustomer = "Customers";
                            getUserInformation("Drivers", driverId);
                            displayCustomerRelatedObjects();
                        }
                    }
                    if (child.getKey().equals("timestamp")){
                        rideDate.setText(getDate(Long.valueOf(child.getValue().toString())));
                    }
                    if (child.getKey().equals("rating")){
                        mRatingBar.setRating(Integer.valueOf(child.getValue().toString()));

                    }
                    if (child.getKey().equals("distance")){
                        distance = child.getValue().toString();
                        rideDistance.setText(distance.substring(0, Math.min(distance.length(), 5)) + " km");
                        ridePrice = Double.valueOf(distance) * 0.5;

                    }
                    if (child.getKey().equals("destination")){
                        rideLocation.setText(child.getValue().toString());
                    }
                    if (child.getKey().equals("location")){
                        pickupLatLng = new LatLng(Double.valueOf(child.child("from").child("lat").getValue().toString()), Double.valueOf(child.child("from").child("lng").getValue().toString()));
                        destinationLatLng = new LatLng(Double.valueOf(child.child("to").child("lat").getValue().toString()), Double.valueOf(child.child("to").child("lng").getValue().toString()));
                        if(destinationLatLng != new LatLng(0,0)){
                            getRouteToMarker();
                        }
                    }
                }
            }
        }

0 个答案:

没有答案