android-developers
[Arriba] [Todas las Listas]

[android-developers] Geofences No provocando (pendingintents y broadcast

To: android-developers@xxxxxxxxxxxxxxxx
Subject: [android-developers] Geofences No provocando (pendingintents y broadcastreceiver)
From: Gregor <gregorp@xxxxxxxxx>
Date: Wed, 10 Sep 2014 01:37:14 -0700 (PDT)
Delivery-date: Wed, 10 Sep 2014 04:38:25 -0400
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=date:from:to:message-id:subject:mime-version:x-original-sender :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:sender:list-subscribe:list-unsubscribe:content-type; bh=RmMDI8M7djhT+vktVzEzIrfTqXWY8CO0GORIHnyJ4L4=; b=tyaYfAnYWSS08dhWw7gVr3OkW2NE7ZPGZVJ2icx52PCxPhWzOZXJjInn9huWEg1538 xPyJ6dfc8T8psy7AUxiuIXY2FdKddH+++1PrMT+Zh+nvcbCDv1dJ8j/QzqttC2/spvpb hgEIIPEXI0gN6eulO3SwOm6V0y5eV+fkckpI7FK0JFtPmT4uK9r5aQReCDNYRqbhDV8y 9+yyZUqCf8LI7Ndeom8hKVay/OEQbxNcLdz9eeq8HHJ+3FgATKO8ce8X59P/pn6Uc19L kdsHVbCgds0VitvJzlZQf8JJguWMkLmp7UAmPCWtMqdKK0BEAGAEarPI1MFg/fg0HL2S vZ1w==
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:message-id:subject:mime-version:x-original-sender :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:sender:list-subscribe:list-unsubscribe:content-type; bh=RmMDI8M7djhT+vktVzEzIrfTqXWY8CO0GORIHnyJ4L4=; b=qE7w30B0sd2tf0N1g8mZ0wWXgFh3SDw4XrT+m9AZ8byI/auMJ/sB49Q7fB81fESMWa kWc0y3C0GHyTUkpNIO1bYmnH/neiRJNH9MrVdJIyAKzSQFuokN49K/NjyImFGarckeLc nV8jwVQg2KpTwx7FeqAkoEtWdxFy8L4kAXH5qdZuzqk0w1A7t2ZXcY+iPEmhZXQTQ4zU fmzhX8j3Fe2kZyl/xqyPAGbHtq/S27VBSn86qWz6QHGpufYrWrzR2CQpDDT3OPcYo7SM ca47qzJBt64h3EoyKYh/AnYXuWhSZUvza/54X6Fa4JMiGiI/YDK42a5WAr47JJQHnP6u EHfA==
Envelope-to: traductor@xxxxxxxxxxx
List-archive: <http://groups.google.com/group/android-developer>
List-help: <http://groups.google.com/support/>, <mailto:android-developers+help@googlegroups.com>
List-id: <android-developers.googlegroups.com>
List-post: <http://groups.google.com/group/android-developers/post>, <mailto:android-developers@googlegroups.com>
List-subscribe: <http://groups.google.com/group/android-developers/subscribe>, <mailto:android-developers+subscribe@googlegroups.com>
List-unsubscribe: <mailto:googlegroups-manage+364598216046+unsubscribe@googlegroups.com>, <http://groups.google.com/group/android-developers/subscribe>
Mailing-list: list android-developers@xxxxxxxxxxxxxxxx; contact android-developers+owners@xxxxxxxxxxxxxxxx
Reply-to: android-developers@xxxxxxxxxxxxxxxx
Sender: android-developers@xxxxxxxxxxxxxxxx

He utilizado el *Android *tutorial con *Geofences que, evidentemente, no trabaja cuándo *app es cerrado. Tan, después de buscar alrededor, he *noticed usuario 
*b-*ryce en el SO utilizó *BroadcastReceiver tan *geofences conseguir provocado incluso si *app 
no es activo (vínculo para su cuestión de SO 
<*http://*stackoverflow.*com/Cuestiona/19505614/*android-*geofence-finalmente-parón-consiguiendo-transición-*intents/19521823#19521823>
).

Justo no puedo forzar *geofences para provocar cuándo muevo fuera de/ubicación 
registrada dentro. Aquí mi procedimiento:

    /**
     * *GeoLocation biblioteca
     */
    *mGeoLocation = nuevo *GeoLocation(*sInstance);


    /**
     * *mReceiver *init
     */
    *mReceiver = nuevo *Receiver();
    *sInstance.*registerReceiver(*mReceiver, *mReceiver.*createIntentFilter());

Y dentro *GeoLocation clase:

/*
 * Crear un *PendingIntent que provoca un *IntentService en vuestro
 * *app cuándo un *geofence la transición ocurre.
 */Protegido *PendingIntent *getTransitionPendingIntent()
    #cnj (*mGeoPendingIntent != *null)
        #Nom *mGeoPendingIntent;
    }

    más

        // #inf un explícito *Intent
        //  *Intent *intent = nuevo *Intent(*mContext,
        //          *ReceiveTransitionsIntentService.Clase);

        *Intent *intent = nuevo *Intent(*getClass().*getPackage().*getName() + ".*GEOFENCE_RECIBE");

        /**
         * Regreso el *PendingIntent
         */
        regreso *PendingIntent.*getBroadcast(
                *mContext,
                0,
                *intent,
                *PendingIntent.La BANDERA_ACTUALIZA_CORRIENTE);

    }}

Aquí qué creo nuevo *geofence:

                        *Geofence la valla = nueva *Geofence.Constructor()
                                .*setRequestId(*hashCode)
                                        // Cuándo introduciendo este *geofence
                                .*setTransitionTypes(*Geofence.*GEOFENCE_La TRANSICIÓN_INTRODUCE | *Geofence.*GEOFENCE_SALIDA_de TRANSICIÓN)
                                .*setCircularRegion(
                                        Doble.*parseDouble(Solo.*getSetting("Latitud")),
                                        Doble.*parseDouble(Solo.*getSetting("*longitude")),
                                        *Float.*parseFloat(Solo.*getSetting("*radius")) // *radius En *meters
                                )
                                .*setExpirationDuration(*Geofence.NUNCA_*EXPIRE)
                                .Complexión();

                        *mGeofences.Añade(valla);

la Variedad consigue poblada y llamamos *AddGeofences método dentro de *Geofence clase

*mGeoLocation.*AddGeofences(*mGeofences);

*AndroidManifest.*xml Para *reciever clase:

    <!-- *RECEIVER -->
    <*receiver *android:Nombre=".*Receiver" >
    </*receiver>

Y el *Receiver la clase tiene que justo *log cuándo *geofence público

de gatillos *void *onReceive(contexto de Contexto, *Intent *intent)
    #nom_de_nom de Cadena = *intent.*getAction();

    *Log.*d("*sfen", "Emisión *recieved "+ acción +" pero no necesitado.");}

El problema es, que *Geofence está provocando SÓLO cuándo abro mapa dentro de mi 
*app donde elijo las ubicaciones. Cerrando el *app (corriéndolo en fondo) 
no provoca cualquier cosa y *geofence las transiciones no provocan cualquier cosa.

Puede alguien me dice lo que soy yo haciendo mal?

-- 
Recibiste este mensaje porque eres *subscribed al *Google
Grupos "*Android *Developers" grupo.
A correo a este grupo, envía *email a *android-developers@xxxxxxxxxxxxxxxx
A *unsubscribe de este grupo, envía *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx

Puesto que más opciones, visita este grupo en
*http://grupos.*google.*com/Grupo/*android-*developers?*hl=*en
--- 
Recibiste este mensaje porque eres *subscribed al *Google Grupos "*Android *Developers" grupo.
A *unsubscribe de este grupo y la parón que recibe *emails de él, enviar un *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx.
Puesto que más opciones, visita *https://grupos.*google.*com/*d/*optout.

I've used the Android tutorial with Geofences which, obviously, doesn't 
work when app is closed. So, after searching around, I've noticed user 
b-ryce on SO used BroadcastReceiver so geofences get triggered even if app 
is not active (link for his SO question 
<http://stackoverflow.com/questions/19505614/android-geofence-eventually-stop-getting-transition-intents/19521823#19521823>
).

I just cannot force geofences to trigger when I move outside/inside 
registered location. Here's my procedure:

    /**
     * GeoLocation library
     */
    mGeoLocation = new GeoLocation(sInstance);


    /**
     * mReceiver init
     */
    mReceiver = new Receiver();
    sInstance.registerReceiver(mReceiver, mReceiver.createIntentFilter());

And inside GeoLocation class:

/*
 * Create a PendingIntent that triggers an IntentService in your
 * app when a geofence transition occurs.
 */protected PendingIntent getTransitionPendingIntent() {
    if (mGeoPendingIntent != null) {
        return mGeoPendingIntent;
    }

    else {

        // Create an explicit Intent
        //  Intent intent = new Intent(mContext,
        //          ReceiveTransitionsIntentService.class);

        Intent intent = new Intent(getClass().getPackage().getName() + ".GEOFENCE_RECEIVE");

        /**
         * Return the PendingIntent
         */
        return PendingIntent.getBroadcast(
                mContext,
                0,
                intent,
                PendingIntent.FLAG_UPDATE_CURRENT);

    }}

Here's how I create new geofence:

                        Geofence fence = new Geofence.Builder()
                                .setRequestId(hashCode)
                                        // when entering this geofence
                                .setTransitionTypes(Geofence.GEOFENCE_TRANSITION_ENTER | Geofence.GEOFENCE_TRANSITION_EXIT)
                                .setCircularRegion(
                                        Double.parseDouble(single.getSetting("latitude")),
                                        Double.parseDouble(single.getSetting("longitude")),
                                        Float.parseFloat(single.getSetting("radius")) // radius in meters
                                )
                                .setExpirationDuration(Geofence.NEVER_EXPIRE)
                                .build();

                        mGeofences.add(fence);

Array gets populated and we call AddGeofences method inside Geofence class

mGeoLocation.AddGeofences(mGeofences);

AndroidManifest.xml for reciever class:

    <!-- RECEIVER -->
    <receiver android:name=".Receiver" >
    </receiver>

And the Receiver class should just log when geofence triggers

public void onReceive(Context context, Intent intent) {
    String action = intent.getAction();

    Log.d("sfen", "Broadcast recieved "+ action +" but not needed.");}

The problem is, that Geofence are triggering ONLY when I open map inside my 
app where I pick the locations. Closing the app (running it in background) 
doesn't trigger anything and geofence transitions don't trigger anything.

Can someone tell me what am I doing wrong?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
android-developers+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@xxxxxxxxxxxxxxxx.
For more options, visit https://groups.google.com/d/optout.
<Anterior por Tema] Tema Actual [Siguiente por Tema>
  • [android-developers] Geofences No provocando (pendingintents y broadcastreceiver), Gregor <=