Answer the question
In order to leave comments, you need to log in
Android: how to implement gps location via BroadcastReceiver?
Good afternoon!
Is it correct approach to take coordinates through BroadcastReceiver?
Or is it like extra. method for determining geodata?
How to use this receiver:
protected BroadcastReceiver singleUpdateReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
context.unregisterReceiver(singleUpdateReceiver);
String key = LocationManager.KEY_LOCATION_CHANGED;
Location location = (Location)intent.getExtras().get(key);
Toast.makeText(getApplicationContext(), "BroadcastReceiver: "+Double.toString(location.getLatitude()), Toast.LENGTH_LONG).show();
}
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question