Hi, this is my very first question:

I'm trying to configure proximity alerts that will be feed from a
Database and webservice provider; but I have a problem configuring a
simple proximity alert for testing. I manage to create the alert but
it never gets fired, I'm only trying in the emulator for now and don“t
know if I need some extra code to trigger the alerts.

I've read somewhere that the GPS provider to disabled so the network
provider can be used in order to trigger the alerts on the emulator.

My code looks like this:

Proximity intent declaration

    private String proximityIntentAction = new
String("gpsdelivery.gpship.getLocation.GPS_PROXIMITY_ALERT");

Inside onStart() where the parameters of the alerts are set

    IntentFilter intentFilter = new
IntentFilter(proximityIntentAction);
    registerReceiver(new ProximityAlert(), intentFilter);
    setProximityAlert(45.150344, 9.999815, -1);

Proximity alert function where the alerts get created

    private void setProximityAlert(double lat, double lon, int
requestCode)
        {
                // 100 meter radius
                float radius = 100f;
                // Expiration is 10 Minutes
                long expiration = 600000;
                LocationManager locManager = (LocationManager)
getSystemService(Context.LOCATION_SERVICE);

                Intent intent = new Intent(proximityIntentAction);
                PendingIntent pendingIntent =
PendingIntent.getBroadcast(getApplicationContext(), requestCode,
intent, PendingIntent.FLAG_CANCEL_CURRENT);
                locManager.addProximityAlert(lat, lon, radius, expiration,
pendingIntent);

        }

And finally my proximity alert class with the Broadcast receiver

    public class ProximityAlert extends BroadcastReceiver
                {
                        @Override
                        public void onReceive(Context context, Intent intent)
                        {
                                Log.v("SomeTag","Proximity alert received");

                        }

                }

Please let me know what I'm missing or what am I doing wrong. Thanks
in advance, any source code would be appreciated.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to