Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class LocationActivity extends AppCompatActivity implements ActivityCompat.OnRequestPermissionsResultCallback {
- // Sets the desired interval for active location updates. This interval is
- // inexact. You may not receive updates at all if no location sources are available, or
- // you may receive them slower than requested. You may also receive updates faster than
- // requested if other applications are requesting location at a faster interval.
- private static final int UPDATE_INTERVAL_MILLI_SECS = 1000;
- // Sets the fastest rate for active location updates. This interval is exact, and your
- // application will never receive updates faster than this value.
- private static final int FASTEST_UPDATE_INTERVAL_MILLI_SECS = 500;
- ...
- private LocationHelper locationHelper;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- ...
- locationHelper = new LocationHelper(this, new LocationConfig(UPDATE_INTERVAL_MILLI_SECS, FASTEST_UPDATE_INTERVAL_MILLI_SECS, LocationConfig.Priority.PRIORITY_HIGH_ACCURACY, true));
- }
- }
Add Comment
Please, Sign In to add comment