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-09-22 18:54:26 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7dbdb264d17c1aeb0a6deb62e3cfc1d3adec6b4d
7dbdb264
1 parent
271e4bd4
new keys
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
26 deletions
warply_android_sdk/build.gradle
warply_android_sdk/src/main/java/ly/warp/sdk/services/WarplyHealthService.java
warply_android_sdk/build.gradle
View file @
7dbdb26
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4-cosbeta7
2
'
PUBLISH_VERSION
=
'4.5.4-cosbeta7
3a
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/services/WarplyHealthService.java
View file @
7dbdb26
...
...
@@ -54,12 +54,10 @@ public class WarplyHealthService extends Service implements SensorEventListener
private
SensorManager
mSensorManager
;
private
Sensor
mSensor
;
// private int mSteps = 0;
// private double mStepsAll = 0.0d;
private
final
int
ACCEL_RING_SIZE
=
50
;
private
final
int
VEL_RING_SIZE
=
10
;
// change this threshold according to your sensitivity preferences
private
final
float
STEP_THRESHOLD
=
18
f
;
// default 40, cosmote default 20
private
final
float
STEP_THRESHOLD
=
50
f
;
// default 40, cosmote default 20
private
final
int
STEP_DELAY_NS
=
250000000
;
private
int
accelRingCounter
=
0
;
private
float
[]
accelRingX
=
new
float
[
ACCEL_RING_SIZE
];
...
...
@@ -69,7 +67,8 @@ public class WarplyHealthService extends Service implements SensorEventListener
private
float
[]
velRing
=
new
float
[
VEL_RING_SIZE
];
private
long
lastStepTimeNs
=
0
;
private
float
oldVelocityEstimate
=
0
;
private
double
mPacingMeters
=
0.0d
;
private
double
eventMeters
=
0.0d
;
private
int
sumSteps
=
0
;
// ===========================================================
// Contructors
...
...
@@ -86,7 +85,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
mSensorManager
=
(
SensorManager
)
getSystemService
(
Context
.
SENSOR_SERVICE
);
mSensor
=
mSensorManager
.
getDefaultSensor
(
Sensor
.
TYPE_ACCELEROMETER
);
WarplyManager
.
getPacingDetails
(
new
PacingDetailsRequest
(),
mPacingCallback
);
registerStepSensor
(
);
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
O
)
...
...
@@ -138,11 +137,10 @@ public class WarplyHealthService extends Service implements SensorEventListener
super
.
onDestroy
();
unregisterStepSensor
();
// mStepsAll = 0.0d;
// WarpUtils.setStepsMetersCounter(this, 0.0d);
WarplyManagerHelper
.
mStepsWebview
=
0
;
WarplyManagerHelper
.
mMetersWebview
=
0.0d
;
mPacingMeters
=
0.0d
;
eventMeters
=
0.0d
;
sumSteps
=
0
;
sendSteps
();
}
...
...
@@ -212,19 +210,17 @@ public class WarplyHealthService extends Service implements SensorEventListener
if
(
velocityEstimate
>
STEP_THRESHOLD
&&
oldVelocityEstimate
<=
STEP_THRESHOLD
&&
(
timeNs
-
lastStepTimeNs
>
STEP_DELAY_NS
))
{
// mStepsAll++;
WarplyManagerHelper
.
mStepsWebview
++;
sumSteps
++;
WarplyManagerHelper
.
mSteps
+=
WarplyManagerHelper
.
mStepsWebview
;
WarpUtils
.
setStepsCounter
(
this
,
WarplyManagerHelper
.
mSteps
);
WarplyManagerHelper
.
mMetersWebview
=
(
WarplyManagerHelper
.
mStepsWebview
*
0.762
);
HealthEventModel
healthSteps
=
new
HealthEventModel
();
// healthSteps.setMeters((mStepsAll * 0.762)); // 16/09/2022
// healthSteps.setMeters(WarplyManagerHelper.mMetersWebview); // 20/09/2022
double
eventMeters
=
0.0d
;
eventMeters
=
mPacingMeters
+
WarplyManagerHelper
.
mMetersWebview
;
eventMeters
=
(
sumSteps
*
0.762
);
healthSteps
.
setMeters
(
eventMeters
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
healthSteps
));
// WarpUtils.setStepsMetersCounter(this, (mStepsAll * 0.762));
lastStepTimeNs
=
timeNs
;
}
...
...
@@ -292,17 +288,4 @@ public class WarplyHealthService extends Service implements SensorEventListener
});
}
}
private
CallbackReceiver
<
PacingDetails
>
mPacingCallback
=
new
CallbackReceiver
<
PacingDetails
>()
{
@Override
public
void
onSuccess
(
PacingDetails
result
)
{
mPacingMeters
=
result
.
getMeters
().
getDay
().
getValue
();
registerStepSensor
();
}
@Override
public
void
onFailure
(
int
errorCode
)
{
registerStepSensor
();
}
};
}
...
...
Please
register
or
login
to post a comment