You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/07/09 21:14:24 UTC
[GitHub] [cordova-plugin-geolocation] janpio commented on a change in pull
request #168: Android native geolocation
janpio commented on a change in pull request #168: Android native geolocation
URL: https://github.com/apache/cordova-plugin-geolocation/pull/168#discussion_r301797021
##########
File path: src/android/FusedLocationHelper.java
##########
@@ -166,8 +169,38 @@ public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
@Override
public void onLocationChanged(Location location) {
if (location != null) {
- // locationTv.setText("Latitude : " + location.getLatitude() + "\nLongitude : " + location.getLongitude());
- Log.d(TAG, "Latitude : " + location.getLatitude() + "\nLongitude : " + location.getLongitude());
+ // locationTv.setText("Latitude : " + location.getLatitude() + "\nLongitude : " + location.getLongitude());
+ Log.d(TAG, "Latitude : " + location.getLatitude() + "\nLongitude : " + location.getLongitude());
+ String locationApiUrl = mActivity.getString(mActivity.getResources().getIdentifier( "save_url", "string", mActivity.getPackageName()));
+
+ JSONObject obj = new JSONObject();
+ try {
+ obj.put("user_id", 1);
+ obj.put("latitude", location.getLatitude());
+ obj.put("longitude", location.getLongitude());
+ obj.put("timestamp", location.getTime());
+
+ } catch (JSONException e) {
+ throw new RuntimeException(e);
+ }
+
+ JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, locationApiUrl, obj,
Review comment:
I think this is the second feature I referred to here: https://github.com/apache/cordova-plugin-geolocation/pull/168#issuecomment-509143411
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org