Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_android_sdk_maven_plugin
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Panagiotis Triantafyllou
2022-02-17 15:35:16 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
83528a3b1b21b053b9feccd3680f44752b80110f
83528a3b
1 parent
9596ae7b
version 4.5.2
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
24 deletions
warply_android_sdk/build.gradle
warply_android_sdk/src/main/java/ly/warp/sdk/services/UpdateUserLocationService.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/PermissionsUtil.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyDeviceInfoCollector.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/constants/WarpConstants.java
warply_android_sdk/build.gradle
View file @
83528a3
...
...
@@ -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'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/services/UpdateUserLocationService.java
View file @
83528a3
...
...
@@ -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
;
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/PermissionsUtil.java
View file @
83528a3
...
...
@@ -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
};
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyDeviceInfoCollector.java
View file @
83528a3
...
...
@@ -390,7 +390,7 @@ public class WarplyDeviceInfoCollector {
return
json
;
}
p
rivate
boolean
isPackageInstalled
(
String
packageName
,
PackageManager
packageManager
)
{
p
ublic
boolean
isPackageInstalled
(
String
packageName
,
PackageManager
packageManager
)
{
try
{
return
packageManager
.
getApplicationInfo
(
packageName
,
0
).
enabled
;
}
catch
(
PackageManager
.
NameNotFoundException
e
)
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/constants/WarpConstants.java
View file @
83528a3
...
...
@@ -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
...
...
Please
register
or
login
to post a comment