Showing
5 changed files
with
25 additions
and
24 deletions
| ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' | ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' |
| 2 | 2 | ||
| 3 | ext { | 3 | ext { |
| 4 | PUBLISH_GROUP_ID = 'ly.warp' | 4 | PUBLISH_GROUP_ID = 'ly.warp' |
| 5 | - PUBLISH_VERSION = '4.5.1' | 5 | + PUBLISH_VERSION = '4.5.2' |
| 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
| 7 | } | 7 | } |
| 8 | 8 | ... | ... |
| ... | @@ -121,11 +121,11 @@ public class UpdateUserLocationService extends /*Service*/ JobIntentService { | ... | @@ -121,11 +121,11 @@ public class UpdateUserLocationService extends /*Service*/ JobIntentService { |
| 121 | } | 121 | } |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | - @Override | 124 | +// @Override |
| 125 | - public IBinder onBind(Intent arg0) { | 125 | +// public IBinder onBind(Intent arg0) { |
| 126 | - // We don't provide binding, so return null | 126 | +// // We don't provide binding, so return null |
| 127 | - return null; | 127 | +// return null; |
| 128 | - } | 128 | +// } |
| 129 | 129 | ||
| 130 | // tells handler to send a message | 130 | // tells handler to send a message |
| 131 | class firstTask extends TimerTask { | 131 | class firstTask extends TimerTask { |
| ... | @@ -140,15 +140,15 @@ public class UpdateUserLocationService extends /*Service*/ JobIntentService { | ... | @@ -140,15 +140,15 @@ public class UpdateUserLocationService extends /*Service*/ JobIntentService { |
| 140 | 140 | ||
| 141 | @Override | 141 | @Override |
| 142 | public boolean handleMessage(Message msg) { | 142 | public boolean handleMessage(Message msg) { |
| 143 | - | 143 | + if (Warply.getWarplyContext() != null) { |
| 144 | if ((new WarplyPreferences(Warply.getWarplyContext()).getUpdateLocationServiceStatus()).equals("off")) { | 144 | if ((new WarplyPreferences(Warply.getWarplyContext()).getUpdateLocationServiceStatus()).equals("off")) { |
| 145 | timer.cancel(); | 145 | timer.cancel(); |
| 146 | stopSelf(); | 146 | stopSelf(); |
| 147 | - } | 147 | + } else { |
| 148 | - else { | ||
| 149 | if (isGeofencingEnabled() && (getGeofences() == null || getGeofences().isEmpty())) | 148 | if (isGeofencingEnabled() && (getGeofences() == null || getGeofences().isEmpty())) |
| 150 | retrieveGeofences(); | 149 | retrieveGeofences(); |
| 151 | } | 150 | } |
| 151 | + } | ||
| 152 | Log.i("regulation", "regulation started"); | 152 | Log.i("regulation", "regulation started"); |
| 153 | regulateLocationReporting(); | 153 | regulateLocationReporting(); |
| 154 | 154 | ||
| ... | @@ -174,6 +174,7 @@ public class UpdateUserLocationService extends /*Service*/ JobIntentService { | ... | @@ -174,6 +174,7 @@ public class UpdateUserLocationService extends /*Service*/ JobIntentService { |
| 174 | @Override | 174 | @Override |
| 175 | public void onSuccess(JSONObject result) { | 175 | public void onSuccess(JSONObject result) { |
| 176 | } | 176 | } |
| 177 | + | ||
| 177 | @Override | 178 | @Override |
| 178 | public void onFailure(int errorCode) { | 179 | public void onFailure(int errorCode) { |
| 179 | WarpUtils.log("failed during sending location data with error " + errorCode); | 180 | WarpUtils.log("failed during sending location data with error " + errorCode); |
| ... | @@ -191,7 +192,7 @@ public class UpdateUserLocationService extends /*Service*/ JobIntentService { | ... | @@ -191,7 +192,7 @@ public class UpdateUserLocationService extends /*Service*/ JobIntentService { |
| 191 | // ------------------- Geofencing ------------------- | 192 | // ------------------- Geofencing ------------------- |
| 192 | 193 | ||
| 193 | private void retrieveGeofences() { | 194 | private void retrieveGeofences() { |
| 194 | - if(!isGeofencingEnabled()) | 195 | + if (!isGeofencingEnabled()) |
| 195 | return; | 196 | return; |
| 196 | JSONObject jObj = new JSONObject(); | 197 | JSONObject jObj = new JSONObject(); |
| 197 | try { | 198 | try { |
| ... | @@ -205,38 +206,38 @@ public class UpdateUserLocationService extends /*Service*/ JobIntentService { | ... | @@ -205,38 +206,38 @@ public class UpdateUserLocationService extends /*Service*/ JobIntentService { |
| 205 | @Override | 206 | @Override |
| 206 | public void onSuccess(JSONObject result) { | 207 | public void onSuccess(JSONObject result) { |
| 207 | JSONObject json = result.optJSONObject("context"); | 208 | JSONObject json = result.optJSONObject("context"); |
| 208 | - if(json != null){ | 209 | + if (json != null) { |
| 209 | try { | 210 | try { |
| 210 | JSONArray geoArray = json.getJSONArray("MAPP_GEOFENCING"); | 211 | JSONArray geoArray = json.getJSONArray("MAPP_GEOFENCING"); |
| 211 | geofences = new ArrayList<>(); | 212 | geofences = new ArrayList<>(); |
| 212 | - for(int i=0;i<geoArray.length();i++){ | 213 | + for (int i = 0; i < geoArray.length(); i++) { |
| 213 | getGeofences().add(new WarpGeoFence(geoArray.getJSONObject(i))); | 214 | getGeofences().add(new WarpGeoFence(geoArray.getJSONObject(i))); |
| 214 | } | 215 | } |
| 215 | } catch (JSONException e) { | 216 | } catch (JSONException e) { |
| 216 | - if(BuildConfig.DEBUG) | 217 | + if (BuildConfig.DEBUG) |
| 217 | e.printStackTrace(); | 218 | e.printStackTrace(); |
| 218 | geofences = null; | 219 | geofences = null; |
| 219 | WarpUtils.log("failed during parsing geofencing data."); | 220 | WarpUtils.log("failed during parsing geofencing data."); |
| 220 | } | 221 | } |
| 221 | } | 222 | } |
| 222 | } | 223 | } |
| 224 | + | ||
| 223 | @Override | 225 | @Override |
| 224 | public void onFailure(int errorCode) { | 226 | public void onFailure(int errorCode) { |
| 225 | geofences = null; | 227 | geofences = null; |
| 226 | WarpUtils.log("failed during getting geofencing data with error " + errorCode); | 228 | WarpUtils.log("failed during getting geofencing data with error " + errorCode); |
| 227 | } | 229 | } |
| 228 | }); | 230 | }); |
| 229 | - } | 231 | + } else { |
| 230 | - else { | ||
| 231 | WarpUtils.log("Could not get geofencing data. You must registrer to warply first"); | 232 | WarpUtils.log("Could not get geofencing data. You must registrer to warply first"); |
| 232 | } | 233 | } |
| 233 | } | 234 | } |
| 234 | 235 | ||
| 235 | - public boolean isInsideFence(double lat, double lon){ | 236 | + public boolean isInsideFence(double lat, double lon) { |
| 236 | - if(getGeofences() == null) | 237 | + if (getGeofences() == null) |
| 237 | return false; | 238 | return false; |
| 238 | - for(WarpGeoFence fence : getGeofences()){ | 239 | + for (WarpGeoFence fence : getGeofences()) { |
| 239 | - if(fence.isInsideFence(lat, lon)) | 240 | + if (fence.isInsideFence(lat, lon)) |
| 240 | return true; | 241 | return true; |
| 241 | } | 242 | } |
| 242 | return false; | 243 | return false; | ... | ... |
| ... | @@ -38,9 +38,9 @@ public class PermissionsUtil{ | ... | @@ -38,9 +38,9 @@ public class PermissionsUtil{ |
| 38 | // PERMISSION_WRITE_EXTERNAL = Manifest.permission.WRITE_EXTERNAL_STORAGE; | 38 | // PERMISSION_WRITE_EXTERNAL = Manifest.permission.WRITE_EXTERNAL_STORAGE; |
| 39 | 39 | ||
| 40 | private static final String[] DANGEROUS_PERMISSIONS = { | 40 | private static final String[] DANGEROUS_PERMISSIONS = { |
| 41 | - PERMISSION_LOCATION_FINE, | 41 | +// PERMISSION_LOCATION_FINE, |
| 42 | - PERMISSION_LOCATION_COARSE, | 42 | +// PERMISSION_LOCATION_COARSE, |
| 43 | - PERMISSION_PHONE_STATE, | 43 | +// PERMISSION_PHONE_STATE, |
| 44 | // PERMISSION_WRITE_EXTERNAL | 44 | // PERMISSION_WRITE_EXTERNAL |
| 45 | }; | 45 | }; |
| 46 | 46 | ... | ... |
| ... | @@ -390,7 +390,7 @@ public class WarplyDeviceInfoCollector { | ... | @@ -390,7 +390,7 @@ public class WarplyDeviceInfoCollector { |
| 390 | return json; | 390 | return json; |
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | - private boolean isPackageInstalled(String packageName, PackageManager packageManager) { | 393 | + public boolean isPackageInstalled(String packageName, PackageManager packageManager) { |
| 394 | try { | 394 | try { |
| 395 | return packageManager.getApplicationInfo(packageName, 0).enabled; | 395 | return packageManager.getApplicationInfo(packageName, 0).enabled; |
| 396 | } catch (PackageManager.NameNotFoundException e) { | 396 | } catch (PackageManager.NameNotFoundException e) { | ... | ... |
| ... | @@ -30,7 +30,7 @@ public class WarpConstants { | ... | @@ -30,7 +30,7 @@ public class WarpConstants { |
| 30 | /** | 30 | /** |
| 31 | * The version of the SDK installed in the device | 31 | * The version of the SDK installed in the device |
| 32 | */ | 32 | */ |
| 33 | - public static final String SDK_VERSION = "4.5.1"; | 33 | + public static final String SDK_VERSION = "4.5.2"; |
| 34 | 34 | ||
| 35 | /** | 35 | /** |
| 36 | * The URL of the server where it should ping | 36 | * The URL of the server where it should ping | ... | ... |
-
Please register or login to post a comment