Articles

Affichage des articles associés au libellé FINE_LOCATION

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();

Tutoriel Android : Géolocalisation du téléphone de l'utilisateur sur un GoogleMap V2 à travers un Marker

Image
Dans un tuto précédent nous avons appris à intégrer GoogleMap V2  dans son application. Cet article constitue la suite de ce précédent tutoriel et ne pourrait être réalisé qu'après avoir effectué le travail présenté par ce tuto :  Tutoriel Android : intégrer Google Map V2 dans son app avec Android Studio  . Maintenant après avoir intégrer la Map dans son application nous allons apprendre à géolocaliser l’appareil de l'utilisateur sur la Map à travers un marker. Pour pouvoir géolocaliser l'utilisateur nous devons  implémenter l'interface OnLocationListener. Le code de notre activité expliquera mieux : import android.Manifest; import android.app.ProgressDialog; import android.content.pm.PackageManager; import android.location.Criteria; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.support.v4.app.ActivityCompat; import android.support.v4.app.FragmentActivity; import an