Articles

Affichage des articles associés au libellé geolocation android

Android Tutorial: Geolocation of the user's phone on a GoogleMap V2 through a Marker

Image
Geolocation of the  phone on a GoogleMap In a previous tutorial we learned how to integrate Google Maps V2 in an application. This article is a continuation of the previous tutorial and could be performed only after completing the work presented in this tutorial:  Integrating Google Map V2 in an Android app with Android Studio  . Now after integrating the Map. we will learn : how to geo-locate the user's device on the Map through a marker.  To geo-locate the user we must implement the interface OnLocationListener. The code of our activity will explain better: public class Map extends AppCompatActivity implements LocationListener{ LocationManager l; GoogleMap gMap; Marker marker; String providerFine; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map); gMap = ((MapFragment)getFragmentManager().findFragmentById(R.id.map)).getMap();