예제 #1
0
        [JavascriptInterface] // This is also needed in API 17+
        // to become consistent with Java/JS interop convention, the argument cannot be System.String.
        //public JsonObject GetDeviceCurrentLocation(string iJSONWebViewParameters)
        public string ClearDeviceLocalDataStoreValues(string iJSONWebViewParameters)
        {
            // ((HomeActivity)_context).RunOnUiThread(() =>
            {
                try
                {
                    JsonObject loLocationResult = new JsonObject();
                    Android.Locations.Location oneCurrentLocation = DroidContext.GetCurrentLocation(); //LocationUpdateListener.GetLastUpdatedLocation();
                    if (oneCurrentLocation != null)
                    {
                        loLocationResult.Add("LAT", oneCurrentLocation.Latitude.ToString());
                        loLocationResult.Add("LONG", oneCurrentLocation.Longitude.ToString());
                    }

                    return(loLocationResult.ToString());
                }
                catch (Exception ex)
                {
                    LoggingManager.LogApplicationError(ex, "WebViewMapFragment", "GetDeviceCurrentLocation");
                    Toast.MakeText(_context, "Error in WebViewMapFragment.GetDeviceCurrentLocation", ToastLength.Long).Show();
                    return("GetDeviceCurrentLocation Error: " + ex.Message);
                }
            }  //);
        }
예제 #2
0
 public DroidRepository(DroidContext context)
 {
     this.context = context;
 }