11package uk .co .appoly .arcorelocation .sensor ;
22
3- import android .content .Context ;
43import android .location .Criteria ;
5- import android .location .GpsStatus ;
64import android .location .Location ;
75import android .location .LocationListener ;
86import android .location .LocationManager ;
@@ -169,13 +167,16 @@ private boolean filterAndAddLocation(Location location) {
169167 if (age > 5 * 1000 ) { //more than 5 seconds
170168 Log .d (TAG , "Location is old" );
171169 oldLocationList .add (location );
172- Toast .makeText (locationScene .mContext , "Rejected: old" , Toast .LENGTH_SHORT ).show ();
170+
171+ if (locationScene .isDebugEnabled ())
172+ Toast .makeText (locationScene .mContext , "Rejected: old" , Toast .LENGTH_SHORT ).show ();
173173 return false ;
174174 }
175175
176176 if (location .getAccuracy () <= 0 ) {
177177 Log .d (TAG , "Latitidue and longitude values are invalid." );
178- Toast .makeText (locationScene .mContext , "Rejected: invalid" , Toast .LENGTH_SHORT ).show ();
178+ if (locationScene .isDebugEnabled ())
179+ Toast .makeText (locationScene .mContext , "Rejected: invalid" , Toast .LENGTH_SHORT ).show ();
179180 noAccuracyLocationList .add (location );
180181 return false ;
181182 }
@@ -185,7 +186,8 @@ private boolean filterAndAddLocation(Location location) {
185186 if (horizontalAccuracy > getMinimumAccuracy ()) { //10meter filter
186187 Log .d (TAG , "Accuracy is too low." );
187188 inaccurateLocationList .add (location );
188- Toast .makeText (locationScene .mContext , "Rejected: innacurate" , Toast .LENGTH_SHORT ).show ();
189+ if (locationScene .isDebugEnabled ())
190+ Toast .makeText (locationScene .mContext , "Rejected: innacurate" , Toast .LENGTH_SHORT ).show ();
189191 return false ;
190192 }
191193
@@ -220,7 +222,8 @@ private boolean filterAndAddLocation(Location location) {
220222 }
221223
222224 kalmanNGLocationList .add (location );
223- Toast .makeText (locationScene .mContext , "Rejected: kalman filter" , Toast .LENGTH_SHORT ).show ();
225+ if (locationScene .isDebugEnabled ())
226+ Toast .makeText (locationScene .mContext , "Rejected: kalman filter" , Toast .LENGTH_SHORT ).show ();
224227 return false ;
225228 } else {
226229 kalmanFilter .consecutiveRejectCount = 0 ;
0 commit comments