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
2023-07-06 11:42:16 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
19ea9907e84ee2bed8a5cf58055a62c799d556c9
19ea9907
1 parent
c279c728
telematics addition
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletions
warply_android_sdk/src/main/java/ly/warp/sdk/activities/TelematicsActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/TelematicsActivity.java
View file @
19ea990
...
...
@@ -85,6 +85,7 @@ public class TelematicsActivity extends Activity implements View.OnClickListener
private
double
mSpeed
=
0
;
private
int
orientationCount
=
0
,
touchCount
=
0
;
final
long
REFRESH_TIME
=
100
;
// miliseconds
private
String
mStartTimestamp
=
""
,
mStopTimestamp
=
""
;
// ===========================================================
...
...
@@ -375,6 +376,7 @@ public class TelematicsActivity extends Activity implements View.OnClickListener
}
private
void
registerSensor
()
{
mStartTimestamp
=
String
.
valueOf
(
System
.
currentTimeMillis
());
mSensorManager
=
(
SensorManager
)
getSystemService
(
Context
.
SENSOR_SERVICE
);
mSensor
=
mSensorManager
.
getDefaultSensor
(
Sensor
.
TYPE_ACCELEROMETER
);
mSensorManager
.
registerListener
(
this
,
mSensor
,
SensorManager
.
SENSOR_DELAY_NORMAL
);
...
...
@@ -390,11 +392,17 @@ public class TelematicsActivity extends Activity implements View.OnClickListener
try
{
JSONObject
jobj
=
new
JSONObject
();
JSONObject
jobjData
=
new
JSONObject
();
String
timestamp
=
String
.
valueOf
(
System
.
currentTimeMillis
());
jobjData
.
putOpt
(
"acceleration"
,
mAcceleration
);
jobjData
.
putOpt
(
"speed"
,
mSpeed
);
jobjData
.
putOpt
(
"orientation_count"
,
orientationCount
);
jobjData
.
putOpt
(
"touch_count"
,
touchCount
);
jobj
.
putOpt
(
String
.
valueOf
(
System
.
currentTimeMillis
()),
jobjData
);
jobjData
.
putOpt
(
"timestamp"
,
timestamp
);
jobjData
.
putOpt
(
"start_time"
,
mStartTimestamp
);
jobjData
.
putOpt
(
"stop_time"
,
mStopTimestamp
);
jobjData
.
putOpt
(
"latitude"
,
mLatitude
);
jobjData
.
putOpt
(
"longitude"
,
mLongitude
);
jobj
.
putOpt
(
timestamp
,
jobjData
);
mAccelerationTimestamps
.
add
(
jobj
);
recordsCount
[
0
]++;
mTvRecordsSaved
.
setText
(
String
.
valueOf
(
recordsCount
[
0
]));
...
...
@@ -409,6 +417,7 @@ public class TelematicsActivity extends Activity implements View.OnClickListener
}
private
void
unregisterSensor
()
{
mStopTimestamp
=
String
.
valueOf
(
System
.
currentTimeMillis
());
orientationCount
=
0
;
touchCount
=
0
;
mSensorManager
.
unregisterListener
(
this
);
...
...
Please
register
or
login
to post a comment