com.google.maps.PendingResult Java Examples
The following examples show how to use
com.google.maps.PendingResult.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArmeriaRequestHandler.java From curiostack with MIT License | 6 votes |
@Override public <T, R extends ApiResponse<T>> PendingResult<T> handle( String hostName, String url, String userAgent, String experienceIdHeaderValue, Class<R> clazz, FieldNamingPolicy fieldNamingPolicy, long errorTimeout, Integer maxRetries, ExceptionsAllowedToRetry exceptionsAllowedToRetry, RequestMetrics metrics) { return handleMethod( HttpMethod.GET, hostName, url, HttpData.empty(), userAgent, experienceIdHeaderValue, clazz, fieldNamingPolicy, errorTimeout, maxRetries, exceptionsAllowedToRetry); }
Example #2
Source File: ArmeriaRequestHandler.java From curiostack with MIT License | 6 votes |
@Override public <T, R extends ApiResponse<T>> PendingResult<T> handlePost( String hostName, String url, String payload, String userAgent, String experienceIdHeaderValue, Class<R> clazz, FieldNamingPolicy fieldNamingPolicy, long errorTimeout, Integer maxRetries, ExceptionsAllowedToRetry exceptionsAllowedToRetry, RequestMetrics metrics) { return handleMethod( HttpMethod.POST, hostName, url, HttpData.ofUtf8(payload), userAgent, experienceIdHeaderValue, clazz, fieldNamingPolicy, errorTimeout, maxRetries, exceptionsAllowedToRetry); }
Example #3
Source File: ArmeriaRequestHandler.java From curiostack with MIT License | 5 votes |
private <T, R extends ApiResponse<T>> PendingResult<T> handleMethod( HttpMethod method, String hostName, String url, HttpData payload, String userAgent, String experienceIdHeaderValue, Class<R> clazz, FieldNamingPolicy fieldNamingPolicy, long errorTimeout, Integer maxRetries, ExceptionsAllowedToRetry exceptionsAllowedToRetry) { var client = httpClients.computeIfAbsent( hostName, host -> WebClient.builder(host).factory(clientFactory).options(clientOptions).build()); var gson = gsonForPolicy(fieldNamingPolicy); var headers = RequestHeaders.builder(method, url); if (experienceIdHeaderValue != null) { headers.add("X-Goog-Maps-Experience-ID", experienceIdHeaderValue); } var request = HttpRequest.of(headers.build(), payload); return new ArmeriaPendingResult<>(client, request, clazz, gson); }
Example #4
Source File: NfcDeviceFragment.java From ESeal with Apache License 2.0 | 4 votes |
private void processGoogleMapGeocodeLocation() { GeoApiContext geoApiContext = new GeoApiContext().setApiKey(App.GOOGLE_MAP_API_KEY); GeolocationPayload.GeolocationPayloadBuilder payloadBuilder = new GeolocationPayload.GeolocationPayloadBuilder() .ConsiderIp(false); Activity activity = getActivity(); CellTower.CellTowerBuilder cellTowerBuilder = new CellTower.CellTowerBuilder() .CellId(NetUtil.getCellLocationCid(activity)) .LocationAreaCode(NetUtil.getCellLocationLac(activity)) .MobileCountryCode(Integer.parseInt(NetUtil.getTelephonyNetWorkOperatorMcc(activity))) .MobileNetworkCode(Integer.parseInt(NetUtil.getTelephonyNetWorkOperatorMnc(activity))); payloadBuilder.AddCellTower(cellTowerBuilder.createCellTower()); if (NetUtil.isWifi(getContext())) { WifiAccessPoint.WifiAccessPointBuilder wifiAccessPointBuilder = new WifiAccessPoint.WifiAccessPointBuilder() .MacAddress(NetUtil.getWifiMacAddress(activity)) .SignalStrength(NetUtil.getWifiRssi(activity)); payloadBuilder.AddWifiAccessPoint(wifiAccessPointBuilder.createWifiAccessPoint()); wifiAccessPointBuilder = new WifiAccessPoint.WifiAccessPointBuilder() .MacAddress(NetUtil.getWifiInfo(activity).getBSSID()); payloadBuilder.AddWifiAccessPoint(wifiAccessPointBuilder.createWifiAccessPoint()); } GeolocationApi.geolocate(geoApiContext, payloadBuilder.createGeolocationPayload()) .setCallback(new PendingResult.Callback<GeolocationResult>() { @Override public void onResult(GeolocationResult result) { Log.d(TAG, "onResult() returned: " + result.location.toString()); } @Override public void onFailure(Throwable e) { Log.d(TAG, "onFailure() returned: " + e.getMessage()); } }); }