private void sendGPSData() { RequestDTO w = new RequestDTO(RequestDTO.UPDATE_PROJECT_SITE); ProjectSiteDTO site = new ProjectSiteDTO(); site.setProjectSiteID(projectSite.getProjectSiteID()); site.setLatitude(location.getLatitude()); site.setLongitude(location.getLongitude()); site.setAccuracy(location.getAccuracy()); w.setProjectSite(site); rotateLogo(); WebSocketUtil.sendRequest( ctx, Statics.COMPANY_ENDPOINT, w, new WebSocketUtil.WebSocketListener() { @Override public void onMessage(final ResponseDTO response) { getActivity() .runOnUiThread( new Runnable() { @Override public void run() { stopRotatingLogo(); if (!ErrorUtil.checkServerError(ctx, response)) { return; } Log.w(LOG, "++++++++++++ project site location updated"); } }); } @Override public void onClose() {} @Override public void onError(final String message) { Log.e(LOG, "---- ERROR websocket - " + message); getActivity() .runOnUiThread( new Runnable() { @Override public void run() { Util.showErrorToast(ctx, message); } }); } }); }
public void setLocation(Location location) { if (projectSite == null) return; this.location = location; txtLat.setText("" + location.getLatitude()); txtLng.setText("" + location.getLongitude()); txtAccuracy.setText("" + location.getAccuracy()); if (location.getAccuracy() == seekBar.getProgress() || location.getAccuracy() < seekBar.getProgress()) { listener.onEndScanRequested(); isScanning = false; stopRotatingLogo(); chronometer.stop(); resetLogo(); btnScan.setText(ctx.getString(R.string.start_scan)); btnSave.setVisibility(View.VISIBLE); projectSite.setLatitude(location.getLatitude()); projectSite.setLongitude(location.getLongitude()); projectSite.setAccuracy(location.getAccuracy()); Util.expand(btnSave, 200, null); Log.d(LOG, "----------- onEndScanRequested - stopped scanning"); } Util.flashSeveralTimes(hero, 300, 1, null); }