simple location library
implementation 'io.github.smaranjit:easylocationlib:0.1.4'
for simple uses put this code in main activity, and you are good to go. All settings will be initialized with their default values.
EasyLocationSettings.withActivity(activity).build(); EasyLocationSettings.withActivity(activity)
.setInterval(2000) //in mili second, default 2000
.setFastestInterval(1000) //in mili second, default 1000
.setPriority (EasyLocationSettings.PRIORITY_HIGH_ACCURACY) //default PRIORITY_HIGH_ACCURACY
.setSmallestDisplacement(0) //in meter, default 0
.build(); values for setPriority could be
EasyLocationSettings.PRIORITY_HIGH_ACCURACY//maximum powerEasyLocationSettings.PRIORITY_BALANCED_POWER_ACCURACY//balanced powerEasyLocationSettings.PRIORITY_LOW_POWER//minimal powerEasyLocationSettings.PRIORITY_NO_POWER//no power
EasyLocation.with(context).listener(listener).start();
here, .listener(listener) is optional, you can add listener later using
EasyLocation.addListener(listener);
you can add any no of listener using addListener, which implements EasyLocation.OnLocationEventListener interface, from any where in the application.
EasyLocation.removeListener(listener);
EasyLocation.with(context).stop();