February 2015
Intermediate to advanced
780 pages
19h 22m
English
Listing 4-49. Service Receiving Motion Updates
public class UserMotionService extends IntentService { private static final String TAG = "UserMotionService"; /* * Callback interface for detected activity type changes */ public interface OnActivityChangedListener{ public void onUserActivityChanged(int bestChoice, int bestConfidence, ActivityRecognitionResult newActivity); } /* Last detected activity type */ private DetectedActivity mLastKnownActivity; /* * Marshals requests from the background thread so the * callbacks can be made on the main (UI) thread. */ private CallbackHandler mHandler; private static class CallbackHandler extends Handler { /* Callback ...
Read now
Unlock full access