Last active
June 3, 2019 20:24
-
-
Save Felipe00/8d2e80ce46b33c35d87eef44cc74a7ef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
// other libs.. | |
// smart Location | |
implementation('io.nlopez.smartlocation:library:3.3.3') { | |
transitive = false | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void startLocation() { | |
Context mContext = MainActivity.this; | |
SmartLocation.with(mContext).location().config(LocationParams.NAVIGATION) | |
.start(new OnLocationUpdatedListener() { | |
@Override | |
public void onLocationUpdated(Location location) { | |
Log.w("Localização", "Lat: " + location.getLatitude() + ",Lng: " + location.getLongitude()); | |
} | |
}); | |
} | |
private void stopLocation() { | |
Context mContext = MainActivity.this; | |
SmartLocation.with(mContext).location().stop(); | |
} | |
private void getLocation() { | |
LocationParams params = new LocationParams.Builder().setInterval(5).setDistance(10).setAccuracy(LocationAccuracy.HIGH).build(); | |
SmartLocation.with(context).location().config(params).continuous().start(new OnLocationUpdatedListener() { | |
@Override | |
public void onLocationUpdated(Location location) { | |
Log.i("GPSLocations", | |
"Lat: " + location.getLatitude() | |
+ "\nLng: " + location.getLongitude() | |
+ "\n Acc: " + location.getAccuracy()); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment