Guest User

Untitled

a guest
Nov 23rd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. public class LocationActivity extends AppCompatActivity implements ActivityCompat.OnRequestPermissionsResultCallback {
  2.  
  3. // Sets the desired interval for active location updates. This interval is
  4. // inexact. You may not receive updates at all if no location sources are available, or
  5. // you may receive them slower than requested. You may also receive updates faster than
  6. // requested if other applications are requesting location at a faster interval.
  7. private static final int UPDATE_INTERVAL_MILLI_SECS = 1000;
  8. // Sets the fastest rate for active location updates. This interval is exact, and your
  9. // application will never receive updates faster than this value.
  10. private static final int FASTEST_UPDATE_INTERVAL_MILLI_SECS = 500;
  11.  
  12. ...
  13.  
  14. private LocationHelper locationHelper;
  15.  
  16. @Override
  17. protected void onCreate(Bundle savedInstanceState) {
  18. super.onCreate(savedInstanceState);
  19. ...
  20. locationHelper = new LocationHelper(this, new LocationConfig(UPDATE_INTERVAL_MILLI_SECS, FASTEST_UPDATE_INTERVAL_MILLI_SECS, LocationConfig.Priority.PRIORITY_HIGH_ACCURACY, true));
  21. }
  22. }
Add Comment
Please, Sign In to add comment