geofencing - Android Geofence addGeofences -


i have problem geofencing in android. follow instructions of https://developer.android.com/training/location/geofencing.html build list of geofence, connect locationclient , works , returns connection, can last position... when execute:

mlocationclient.addgeofences(infoapp.mgeofencelist, mtransitionpendingintent, this);

i don't have response in onaddgeofencesresult. don't see message in logcat.

i create geofence code:

muigeofence1 = new simplegeofence( infoestablecimiento.getstring("_id"), infoestablecimiento.getdouble("latitud"), infoestablecimiento.getdouble("longitud"), (float) infoestablecimiento.getdouble("radio"), geofence.never_expire, // geofence records entry transitions delay geofence.geofence_transition_dwell, loiteringdelay); 

first call function request_type.add:

public static void conexiongeofence(         request_type mrequesttype,         context contexto,         slidingfragmentactivity actividad,         googleplayservicesclient.connectioncallbacks connectionact,         googleplayservicesclient.onconnectionfailedlistener connectionlistener) {     // start request add geofences     /*      * test google play services after setting request type. if      * google play services isn't present, proper request can      * restarted.      */     if (!servicesconnected(actividad)) {         return;     }     /*      * create new location client object. since current activity class      * implements connectioncallbacks , onconnectionfailedlistener, pass      * current activity object listener both parameters      */     infoapp.mlocationclient = new locationclient(contexto, connectionact,             connectionlistener);      // if request not underway     if (!infoapp.minprogress) {         infoapp.mrequesttype = mrequesttype;          // indicate request underway         infoapp.minprogress = true;         // request connection client location services         infoapp.mlocationclient.connect();     } else {         /*          * request underway. can handle situation          * disconnecting client, re-setting flag, , re-trying          * request.          */     } } 

i received response in onconnected, when call addgeofences don't receive reponse more.

@override public void onconnected(bundle connectionhint) {     /*      * choose based on request type set in removegeofences      */     switch (infoapp.mrequesttype) {     case add:         // pendingintent request         infoapp.mtransitionpendingintent = geofenceutils                 .gettransitionpendingintent();          location loc = infoapp.mlocationclient.getlastlocation();          // send request add current geofences         infoapp.mlocationclient.addgeofences(infoapp.mgeofencelist,                 infoapp.mtransitionpendingintent, this);         break;      case remove_list:         infoapp.mlocationclient.removegeofences(infoapp.mgeofencestoremove,                 this);         break;      default:         break;     }  } 

thank much!

have waited call addgeofences() until locationclient connected?


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -