IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Android Discussion :

Emplacement telephone portables


Sujet :

Android

  1. #1
    Membre régulier
    Homme Profil pro
    Etudiant du Genie Logiciel
    Inscrit en
    Juillet 2011
    Messages
    397
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Cameroun

    Informations professionnelles :
    Activité : Etudiant du Genie Logiciel
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2011
    Messages : 397
    Points : 73
    Points
    73
    Par défaut Emplacement telephone portables
    SALUT A TOUS . j'ai développé une application de géolocalisation de téléphone portable. le problème est qu'il ne m'affiche l'emplacement du téléphone portable a l’écran . j'utilise un MT65XX Androïde Phone . QUE FAIRE ? J'aimerai recevoir des notifications d'emplacement sur l’écran du téléphone .VOICI mon application
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
     
     
    package com.locartion.service;
     
    import android.app.Service;
    import android.content.Context;
    import android.content.Intent;
    import android.location.Criteria;
    import android.location.Location;
    import android.location.LocationListener;
    import android.location.LocationManager;
    import android.location.LocationProvider;
    import android.os.Bundle;
    import android.os.IBinder;
    import android.widget.Toast;
     
     
    public class MonPremierService extends Service {
     
     
    	  Criteria criteria  = null  ;
     
     
    	 private  LocationManager            locationMgr             = null;
    	 private  LocationListener       onLocationChange    = new LocationListener()
    	 {
    	 @Override
    	 public void onStatusChanged(String provider, int status, Bundle extras)
    	 {
    		 String newStatus = "";
    			switch (status) {
    				case LocationProvider.OUT_OF_SERVICE: newStatus = "OUT_OF_SERVICE" ;
    					break;
    				case LocationProvider.TEMPORARILY_UNAVAILABLE: newStatus = "TEMPORARILY_UNAVAILABLE";
    					break;
    				case LocationProvider.AVAILABLE: newStatus = "AVAILABLE";
    					break;
    			}
     
     
    			String msg = String.format(getResources().getString(R.string.provider_disabled), provider, newStatus);
    			Toast.makeText(getBaseContext(), msg, Toast.LENGTH_SHORT).show();
     
    	 }
     
    	@Override
    	 public void onProviderEnabled(String provider)
    	 {
     
    		String msg = String.format(getResources().getString(R.string.provider_enabled), provider);
    		Toast.makeText(getBaseContext(), msg, Toast.LENGTH_SHORT).show();	
     
    	 }
     
    	@Override
    	 public void onProviderDisabled(String provider)
    	 {
     
    			String msg = String.format(getResources().getString(R.string.statut_changed), provider);
    			Toast.makeText(getBaseContext(), msg, Toast.LENGTH_SHORT).show();	
    	 }
     
    	@Override
    	 public void onLocationChanged(Location location)
    	 {
     
    	 Double latitude = location.getLatitude();
    	 Double longitude = location.getLongitude();
    	 Double altitude = location.getAltitude() ;
    	 Float precision = location.getAccuracy() ;
     
     
    Toast.makeText(MonPremierService.this,"Voici les coordonnées de votre téléphone : " +  latitude + "  "   +   longitude,   Toast.LENGTH_LONG).show();
    Toast.makeText(MonPremierService.this,"Voici les coordonnes de votre telephone :   " + altitude + "  "   +   precision , Toast.LENGTH_LONG).show();
    String msg = String.format(getResources().getString(R.string.new_location), latitude, longitude , altitude, precision);
    Toast.makeText(MonPremierService.this, msg, Toast.LENGTH_LONG).show();
     
    	 }
     
    	 };
     
    	@Override
    	 public IBinder onBind(Intent arg0)
    	 {
    	 return null;
    	 }
     
    	@Override
    	 public void onCreate()
    	 {
     
    	locationMgr = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
     
    	 criteria = new Criteria() ;
    	 criteria.setAccuracy(Criteria.ACCURACY_FINE) ;
    	 criteria.setAltitudeRequired(true);
    	 criteria.setBearingRequired(true);
    	 criteria.setCostAllowed(false);
    	 criteria.setPowerRequirement(Criteria.POWER_HIGH);
    	 criteria.setSpeedRequired(true);
     
     
    	 locationMgr.requestLocationUpdates(locationMgr.getBestProvider(criteria, true) ,1000, 0, onLocationChange);
    	 locationMgr.requestLocationUpdates(locationMgr.getBestProvider(criteria, true), 1000, 0, onLocationChange);
    	 super.onCreate();
     
    	 }
     
    	@Override
    	 public int onStartCommand(Intent intent, int flags, int startId)
    	 {
     
    	return super.onStartCommand(intent, flags, startId);
    	 }
     
    	@Override
    	 public void onDestroy()
    	 {
    	 super.onDestroy();
    	 locationMgr.removeUpdates(onLocationChange);
    	 }
    }

  2. #2
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2011
    Messages
    115
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2011
    Messages : 115
    Points : 106
    Points
    106
    Par défaut
    Voila un tutoriel Android tu peux t'aider de celui -ci : http://android.developpez.com/cours/

Discussions similaires

  1. [Jeux] develloper sur les telephones portable
    Par Fry dans le forum Développement Mobile en Java
    Réponses: 7
    Dernier message: 28/10/2006, 12h55
  2. Emulateur telephone portable
    Par spekal dans le forum Développement Mobile en Java
    Réponses: 1
    Dernier message: 14/06/2006, 19h09
  3. Accès à un téléphone portable Sagem
    Par LeoAnderson dans le forum Applications et environnements graphiques
    Réponses: 3
    Dernier message: 03/01/2006, 18h17
  4. [Mobile] Programmation de téléphone portable
    Par alunix dans le forum Mobiles
    Réponses: 5
    Dernier message: 27/11/2005, 19h59
  5. Jeux java sur telephone portable
    Par lereveur84 dans le forum Développement Mobile en Java
    Réponses: 7
    Dernier message: 19/07/2005, 15h01

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo