2017-04-23 3 views
2

J'essaie d'utiliser geofencing mais je ne veux pas obtenir l'emplacement exact de l'utilisateur. de sorte que j'utilise ACCESS_COARSE_LOCATION. si j'utilise un grand cercle de points de geofence, je pense que ACCESS_COARSE_LOCATION fonctionnera correctement. Peut-être pas de travail parfait mais il donnera une idée approximative de la localisation de l'utilisateur.Comment utiliser GeofencingApi avec juste ACCESS_COARSE_LOCATION

au code docs comme celui-ci

 try { 
     LocationServices.GeofencingApi.addGeofences(
       mGoogleApiClient, 
       // The GeofenceRequest object. 
       getGeofencingRequest(), 
       // A pending intent that that is reused when calling removeGeofences(). This 
       // pending intent is used to generate an intent when a matched geofence 
       // transition is observed. 
       getGeofencePendingIntent() 
     ).setResultCallback(this); // Result processed in onResult(). 
    } catch (SecurityException securityException) { 
     // Catch exception generated if the app does not use ACCESS_FINE_LOCATION permission. 
     logSecurityException(securityException); 
    } 

mais il donne l'erreur car GeofencingApi.addGeofences doit FINE_LOCATION l'autorisation. Comment puis-je utiliser le géofencing avec COARSA_LOCATION

Répondre