Panagiotis Triantafyllou

version 4.5.2

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.1'
PUBLISH_VERSION = '4.5.2'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -121,11 +121,11 @@ public class UpdateUserLocationService extends /*Service*/ JobIntentService {
}
}
@Override
public IBinder onBind(Intent arg0) {
// We don't provide binding, so return null
return null;
}
// @Override
// public IBinder onBind(Intent arg0) {
// // We don't provide binding, so return null
// return null;
// }
// tells handler to send a message
class firstTask extends TimerTask {
......@@ -140,15 +140,15 @@ public class UpdateUserLocationService extends /*Service*/ JobIntentService {
@Override
public boolean handleMessage(Message msg) {
if (Warply.getWarplyContext() != null) {
if ((new WarplyPreferences(Warply.getWarplyContext()).getUpdateLocationServiceStatus()).equals("off")) {
timer.cancel();
stopSelf();
}
else {
} else {
if (isGeofencingEnabled() && (getGeofences() == null || getGeofences().isEmpty()))
retrieveGeofences();
}
}
Log.i("regulation", "regulation started");
regulateLocationReporting();
......@@ -174,6 +174,7 @@ public class UpdateUserLocationService extends /*Service*/ JobIntentService {
@Override
public void onSuccess(JSONObject result) {
}
@Override
public void onFailure(int errorCode) {
WarpUtils.log("failed during sending location data with error " + errorCode);
......@@ -191,7 +192,7 @@ public class UpdateUserLocationService extends /*Service*/ JobIntentService {
// ------------------- Geofencing -------------------
private void retrieveGeofences() {
if(!isGeofencingEnabled())
if (!isGeofencingEnabled())
return;
JSONObject jObj = new JSONObject();
try {
......@@ -205,38 +206,38 @@ public class UpdateUserLocationService extends /*Service*/ JobIntentService {
@Override
public void onSuccess(JSONObject result) {
JSONObject json = result.optJSONObject("context");
if(json != null){
if (json != null) {
try {
JSONArray geoArray = json.getJSONArray("MAPP_GEOFENCING");
geofences = new ArrayList<>();
for(int i=0;i<geoArray.length();i++){
for (int i = 0; i < geoArray.length(); i++) {
getGeofences().add(new WarpGeoFence(geoArray.getJSONObject(i)));
}
} catch (JSONException e) {
if(BuildConfig.DEBUG)
if (BuildConfig.DEBUG)
e.printStackTrace();
geofences = null;
WarpUtils.log("failed during parsing geofencing data.");
}
}
}
@Override
public void onFailure(int errorCode) {
geofences = null;
WarpUtils.log("failed during getting geofencing data with error " + errorCode);
}
});
}
else {
} else {
WarpUtils.log("Could not get geofencing data. You must registrer to warply first");
}
}
public boolean isInsideFence(double lat, double lon){
if(getGeofences() == null)
public boolean isInsideFence(double lat, double lon) {
if (getGeofences() == null)
return false;
for(WarpGeoFence fence : getGeofences()){
if(fence.isInsideFence(lat, lon))
for (WarpGeoFence fence : getGeofences()) {
if (fence.isInsideFence(lat, lon))
return true;
}
return false;
......
......@@ -38,9 +38,9 @@ public class PermissionsUtil{
// PERMISSION_WRITE_EXTERNAL = Manifest.permission.WRITE_EXTERNAL_STORAGE;
private static final String[] DANGEROUS_PERMISSIONS = {
PERMISSION_LOCATION_FINE,
PERMISSION_LOCATION_COARSE,
PERMISSION_PHONE_STATE,
// PERMISSION_LOCATION_FINE,
// PERMISSION_LOCATION_COARSE,
// PERMISSION_PHONE_STATE,
// PERMISSION_WRITE_EXTERNAL
};
......
......@@ -390,7 +390,7 @@ public class WarplyDeviceInfoCollector {
return json;
}
private boolean isPackageInstalled(String packageName, PackageManager packageManager) {
public boolean isPackageInstalled(String packageName, PackageManager packageManager) {
try {
return packageManager.getApplicationInfo(packageName, 0).enabled;
} catch (PackageManager.NameNotFoundException e) {
......
......@@ -30,7 +30,7 @@ public class WarpConstants {
/**
* The version of the SDK installed in the device
*/
public static final String SDK_VERSION = "4.5.1";
public static final String SDK_VERSION = "4.5.2";
/**
* The URL of the server where it should ping
......