public void setMyBearingTrackingMode(@MyBearingTracking.Mode int myBearingTrackingMode) {
   this.myBearingTrackingMode = myBearingTrackingMode;
   if (myBearingTrackingMode == MyBearingTracking.COMPASS) {
     compassListener.onResume();
   } else {
     compassListener.onPause();
     if (myLocationTrackingMode == MyLocationTracking.TRACKING_FOLLOW) {
       // always face north
       gpsDirection = 0;
     }
   }
   invalidate();
   update();
 }
 public void onResume() {
   if (myBearingTrackingMode == MyBearingTracking.COMPASS) {
     compassListener.onResume();
   }
   if (isEnabled()) {
     toggleGps(true);
   }
 }
 public void onPause() {
   compassListener.onPause();
   toggleGps(false);
 }