2. Motivation
Sitting too long could
present you a cancer for
free.
Sitting too long makes
people obese
How long is too long?
What is limit for a day?
5. Design
Wi-Fi-based Location Monitor
Break time monitor
Activities challenges
Walk out of room
Walk out of office
Activities log
6. Design: Activities
MainActivity
Set up Alarm
Manager
Display sitting
duration
SettingsActivity
Configure user’s
preference
HistoryActivity
Display user’s
historic places
where long sitting
takes action
MapActivity
Display a MapView
for Historic places
7. Design: Application work flow
Service:
LocationMonitor
Monitor location
change by watching
surrounding Aps list
BroadcastReceiver:
WifiReceiver
+Receives Wi-Fi scan result
+Updates Aps and History
database
+Monitor location change
+Monitor break time duration
BroadcastReceiver:
AlarmReceiver
Start/Stop LocationMonitor
service
BroadcastReceiver:
BootReceiver
Start monitoring at boot
Runable:
WifiScanner
Scan Wi-Fi for every short
scan periods
Determine when to check for
location
SQLite Database
+Aps list
+Historic Places
ContentProvider:
WirunDbProvider
Load database records
to History activity
8. Design: Wi-Fi-based Location
Monitor
Short scan period: scan every
30s and accumulate the Aps to
Aps lists to increase accuracy
(deal with mobile’s Wi-Fi
device’s instability)
Long scan period: every 15-
30min, perform a short scan
period
After a long scan period reach,
start checking location change
by comparing old Aps list and
new Aps list
9. Design: Wi-Fi-based Location
Monitor
If location has changed, reset
the application and monitor
again for long sitting period
If location has not changed,
check whether or not long
sitting period is reached.
If reached, start break time by
vibrating the phone,
monitoring strongest AP level
to determine location change,
therefore stop vibrating when
user is out of room or building.
10. Design: Wi-Fi-based Location
Monitor
When long sitting period is
reached in a location,
update historic database
for such location.
After break time period,
reset the application and
start monitoring again
11. Design: Break time monitor
Start Wi-Fi scan for every 10s to
determine user location change
Location change is monitored by
monitoring last strongest AP level
After some number of scans (called
“fun number”, users do not tend to
comeback to their seat, i.e., they’re
already enjoy their break) increase Wi-
Fi scan duration to 30s to save batery
12. Design: Activity challenge
Walk out of Room:
monitor the level of
last strongest AP
Walk out of building:
check whether or not
there is no AP in scan
result list
13. Design: Historic places
Every time location not change is
known, record date, place and
sitting duration into history
database
17. Trivial
The vibrator code is Morse code with
dot: short vibrate, dash: long
vibrate, short gap between dot and
dash, medium gap between letters,
and long gap between words
The translated Morse code is “get
the hell out of there!”
18. Thank you for a great course!
Do you have any comments or
questions?