# Energy-Efficient Hosting Rich Content from Mobile Platforms with Relative Proximity Sensing
## 4 On-Demand Wi-Fi Connection to Nearby Mobile Devices
### Location-Update Adaptation Algorithm  
Our mechanism requires mobile devices to periodically update the proxy server with their location. In efforts to obtain behavioral patterns, many studies are being carried out in exploiting this property for determining user context [23; 24]. They attempted to recognize activities using a single three-axis accelerometer worn near the pelvic region and formulated the activity recognition as a classification problem. In this study, we seek to minimize use of the localization module, and avoid unnecessary transmissions over the data network for energy-efficiency. Our approach is based on the observation that a mobile device is stationary most of the time, and if we only update the location when it changes significantly, the impact on battery life will not be significant. To detect when the mobile device has moved, we use the well-known approach of reading the accelerometer sensor on the mobile device. Data from the accelerometer sensor has the following attributes: time, acceleration along \(x\) axis, acceleration along \(y\) axis, and acceleration along \(z\) axis. At a sampling frequency of 25 Hz, the raw accelerometer data is stored on a windows size of 250 in a first-in-first-out manner. Therefore, the window represents data for previous 10 s. The window of several seconds can sufficiently capture cycles in activities such as walking, running. In this work, the mean (absolute value of average) of acceleration (\(x\)-, \(y\)-, and \(z\)-axes) was used to recognize user's activities because it is one of the most accessible measures of time series data [23]. We set the parameters \(\mathrm{V_{drive}}\), \(\mathrm{T_{run}}\), \(\mathrm{T_{walk}}\) to 20 miles/h, 0.12 mv, 0.06 mv, respectively. The parameters \(\mathrm{V_{drive}}\) is configured for the mobile devices equipped with GPS module. We note that the parameter values \(\mathrm{T_{run}}\), \(\mathrm{T_{walk}}\), may vary depending on which a three-axis accelerometer is used in the mobile device. Figure 3a shows the raw accelerometer readings along the three axes for sitting, walking, and running for one person carrying the mobile device. As expected, the sitting traces is flatter than when the person is walking and running. The peaks in the walking and running traces are a good indicator of footstep frequency. When the person runs a larger number of peaks per second is registered than when people walk. The usefulness of these features has been demonstrated in prior work [23; 24]. Given these observations, we find that the mean, standard deviation, and the number of peaks per unit time are accurate feature vector components, providing high classification accuracy [23]. Given these observations, we find that the mean, standard deviation, and the number of peaks per unit time are accurate feature vector components, providing high classification accuracy [23]. Based on these readings we devise an algorithm to determine when the location update should be sent to the proxy server as described in Figure 3b.  
Figure 3: **(a)** The raw accelerometer readings along the three axes for sitting, walking, and running, **(b)** State diagram for duty-cycle scheduling.