Tag: 谷歌 地方 API

Android Place Picker不会返回活动状态

我在我的应用中实现了PlacePicker 。 我有一个自定义对话框,其中包含一个寻呼机(如2个标签)。 第二个寻呼机项目有一个EditText组件。 接触到这一点,我打开了placepicker。 问题是按下PlacePicker ,关闭应用程序而不是从它开始的地方返回活动。 这是PlacePicker启动的代码 public void showPlacePicker() { try { PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder(); startActivityForResult(builder.build(OrganizerMainActivity.this), PLACE_PICKER_REQUEST); } catch (GooglePlayServicesNotAvailableException e) { GoogleApiAvailability.getInstance().getErrorDialog(this, e.errorCode, PLACE_PICKER_REQUEST).show(); e.printStackTrace(); } catch (GooglePlayServicesRepairableException e) { GoogleApiAvailability.getInstance().getErrorDialog(this, e.getConnectionStatusCode(), PLACE_PICKER_REQUEST).show(); e.printStackTrace(); } } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PLACE_PICKER_REQUEST) […]

如何使用Java发送Google地方信息搜索请求

对于20米范围内的任何银行,我需要通过long / lat搜索Goolge Places Pages。 此Google Places文档介绍了如何使用JavaScript。 他们正在使用我在Java中没有的google.maps.LatLng对象。 现在有人怎么打电话给服务? 也许Goolge Places还有一个Java API? 最诚挚的问候,基督徒。 编辑1: 我发现有人像这样构建url: String url = baseUrl + “location=” + lat + “,” + lon + “&” + “radius=” + searchRadius + “&” + types + “&” + “sensor=true” + “&” + “key=” + googleAPIKey; 答案:编辑2: 我因为上面的post我发现了怎么做。 这是如何发送请求的示例: public class GooglePlacesClient { private […]

谷歌放置API返回单一类型“car_repair”

我正在使用Google Places API,它将返回我所在位置的所有位置。 但是我只想让它返回一个“汽车维修”的类型我想我几乎拥有它但我错过了一些东西,如果有人能指导我在正确的方向它会很棒:) 我的代码到目前为止PlacPickerActivity import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.text.Html; import android.view.View; import android.widget.Button; import android.widget.TextView; import com.google.android.gms.common.GooglePlayServicesNotAvailableException; import com.google.android.gms.common.GooglePlayServicesRepairableException; import com.google.android.gms.location.places.Place; import com.google.android.gms.location.places.ui.PlacePicker; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.LatLngBounds; public class PlacePickerActivity extends AppCompatActivity { private static final int PLACE_PICKER_REQUEST = 1; String url=”https://maps.googleapis.com/maps/api/place/textsearch/json?type=car_repair&key=AIzaSyBKsTtLyMBQH8mhvbknJ4MvZwACotmeYO0″; private TextView mName; private TextView mAddress; private […]

请求使用Android应用中使用的用于服务器Web的Google Places API KEY拒绝

我正在尝试从Android应用的Google商家信息API中获取信息。 为此,首先我在Google帐户中启用了此API。 其次,我为浏览器创建了一个API KEY。 由于其他API,我已经有了一个API KEY服务器。 所以,在我的代码中,我已经使用这两个密钥进行了测试,并且两者都得到了相同的结果! { “error_message”:“此服务需要API密钥。”, “html_attributions”:[], “结果”:[], “status”:“REQUEST_DENIED” } 我用来打电话的代码是…… @Override protected String doInBackground(LocationService… ls) { JSONObject result = new JSONObject(); URL url; HttpsURLConnection urlConnection; // Making HTTP request try { //Define connection url = new URL(“https://maps.googleapis.com/maps/api/place/nearbysearch/json”); urlConnection = (HttpsURLConnection)url.openConnection(); urlConnection.setRequestMethod(“POST”); urlConnection.setRequestProperty(“Content-Type”, “application/x-www-form-urlencoded”); urlConnection.setRequestProperty(“charset”, “utf-8”); urlConnection.setRequestProperty(“Accept”, “application/json”); urlConnection.setDoOutput(true); urlConnection.setDoInput(true); urlConnection.setUseCaches(false); //Send […]