From 68b53598afa5d610aa0f69dc84c7a478a95f71b6 Mon Sep 17 00:00:00 2001 From: 14Sandee Date: Wed, 6 Dec 2023 14:47:35 +0530 Subject: [PATCH] , --- .../com/app/simplitend/apputils/AppUtil.java | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/app/simplitend/apputils/AppUtil.java b/app/src/main/java/com/app/simplitend/apputils/AppUtil.java index 3afc5a2..e045046 100644 --- a/app/src/main/java/com/app/simplitend/apputils/AppUtil.java +++ b/app/src/main/java/com/app/simplitend/apputils/AppUtil.java @@ -687,19 +687,23 @@ public abstract class AppUtil { } } - // radius is equal thus, checking for unit of the radius - String local_radius_unit = getPatientGeofenceRadiusUnit(context); - if (!remote_radius_unit.equals(local_radius_unit)) { - // remote radius units are different - // thus, should add geofence - return true; - } - // checking for lat lng String[] local_lat_lng = getPatientLatLng(context); if (data.lat != null && data.lng != null) { - if (!data.lat.equals(local_lat_lng[0]) || !data.lng.equals(local_lat_lng[1])) { - // remote lat lng has changed +// if (!data.lat.equals(local_lat_lng[0]) || !data.lng.equals(local_lat_lng[1])) { +// // remote lat lng has changed +// return true; +// } + + // converting and comparing for precision + try { + if (Double.parseDouble(data.lat) != Double.parseDouble(local_lat_lng[0]) || + Double.parseDouble(data.lng) != Double.parseDouble(local_lat_lng[1])) { + // remote lat lng has changed + return true; + } + } catch (Exception e) { + // meaning, local_lat_lng are null return true; } }