Hey guys,

I'm have a registered BroadcastReceiver that should receive proximity
alerts. I've added the proximity alerts to the objects and that is
successful, LogCat also gives me the message when I am in proximity of
an object:

08-28 09:55:05.344: INFO/LocationManagerService(53): Entered alert
08-28 09:55:05.365: INFO/ActivityManager(53): Starting activity:
Intent { action=android.intent.action.PROXIMITY_ALERT (has extras) }

However, my BroadcastReceiver doesn't ever receive any Intents.

I've posted some of my code below:

- BroadcastReceiver -

public class MyBroadcastReceiver extends BroadcastReceiver {

        @Override
        public void onReceive(Context context, Intent intent) {
                String intentAction = intent.getAction();
                Log.d("DEBUG", "Broadcast received");
                if 
(intentAction.equals("android.intent.action.PROXIMITY_ALERT")) {
                        Log.d("DEBUG", "Received Proximity Alert Broadcast");
                }
        }

}


- Code Using It -

lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
proxBroadcastReceiver = new MyBroadcastReceiver();
// N.B. proxIntentFilter is new
IntentFilter("android.intent.action.PROXIMITY_ALERT");
registerReceiver(proxBroadcastReceiver, proxIntentFilter);

for (// all of my objects) {
        Intent proxIntent = new
Intent("android.intent.action.PROXIMITY_ALERT");
        PendingIntent pi = PendingIntent.getActivity(this, 0, proxIntent,
                                                                        
PendingIntent.FLAG_ONE_SHOT);
        // add proximity alerts
        lm.addProximityAlert(//a latitude, //a longitude, 1000000, 1000000,
pi);
}

I can't see why my BroadcastReceiver wouldn't be working. I did
register it in the manifest, however I am registering dynamically with
registerReceiver(). The manifest should have all of the required
permissions...

<uses-permission xmlns:android="http://schemas.android.com/apk/res/
android" android:name="android.permission.INTERNET"></uses-permission>
        <uses-permission xmlns:android="http://schemas.android.com/apk/res/
android" android:name="android.permission.ACCESS_MOCK_LOCATION"></uses-
permission>
        <uses-permission xmlns:android="http://schemas.android.com/apk/res/
android" android:name="android.permission.ACCESS_COARSE_LOCATION"></
uses-permission>
        <uses-permission xmlns:android="http://schemas.android.com/apk/res/
android" android:name="android.permission.ACCESS_FINE_LOCATION"></uses-
permission>
        <uses-permission xmlns:android="http://schemas.android.com/apk/res/
android"
android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"></
uses-permission>
        <uses-permission xmlns:android="http://schemas.android.com/apk/res/
android" android:name="android.permission.READ_PHONE_STATE"></uses-
permission>

Can anyone think of anything I might of missed or has anyone got the
proximity alerts working in the new SDK? It's really frustrating! :-)

Thanks in advance
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to