I have the alerts working properly, however when an alert is fired all the other alerts seem to get fired too, so if the user goes into car park 4 the messages for the other car parks get fired too.
here is my code
oncreate
Using java Syntax Highlighting
- setProximityAlert(53.984511, -6.395137, "Car Park 1", "You are in a staff/lecturer car park, you must have a valid disk to park here");
- setProximityAlert(53.983862, -6.394853, "Car Park 5", "You are in a staff/lecturer car park, you must have a valid disk to park here");
- setProximityAlert(53.985969, -6.395288, "Car Park 2", "You are in a paid car park, please ensure you have paid for a valid parking ticket for the time you intend to stay parked");
- setProximityAlert(53.986101, -6.394590, "Car Park 3", "You are in a paid car park, please ensure you have paid for a valid parking ticket for the time you intend to stay parked");
- setProximityAlert(53.986350, -6.393346, "Car Park 4", "You are in a paid car park, please ensure you have paid for a valid parking ticket for the time you intend to stay parked");
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
setproximityalert()
Using java Syntax Highlighting
- private void setProximityAlert(double lat, double lng, String title, String text) {
- LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
- // double lat = 53.984511;
- // double lng = -6.395137;
- float radius = 30f; //meters
- long expiration = -1; //do not expire
- Intent intent = new Intent(TREASURE_PROXIMITY_ALERT);
- PendingIntent proximityIntent = PendingIntent.getBroadcast(getApplicationContext(), -1, intent, 0);
- locationManager.addProximityAlert(lat, lng, radius, expiration, proximityIntent);
- IntentFilter filter = new IntentFilter(TREASURE_PROXIMITY_ALERT);
- registerReceiver(new ProximityIntentReceiver(title, text), filter);
- }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
proximityintentreciever
Using java Syntax Highlighting
- public class ProximityIntentReceiver extends BroadcastReceiver {
- Game2 game = new Game2();
- String title;
- String text2;
- public ProximityIntentReceiver(String title, String text){
- this.title = title;
- this.text2 = text;
- }
- @Override
- public void onReceive (Context context, Intent intent) {
- String key = LocationManager.KEY_PROXIMITY_ENTERING;
- Log.d("PROXIMITy KEY ENTER", LocationManager.KEY_PROXIMITY_ENTERING);
- Boolean entering = intent.getBooleanExtra(key, false);
- Dialog d = new Dialog(Game2.this);
- // Have the new window tint and blur the window it
- // obscures.
- Window window = d.getWindow();
- window.setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
- WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
- d.setTitle(title);
- d.setContentView(R.layout.dialog_view);
- TextView text = (TextView)d.findViewById(R.id.dialogTextView);
- text.setText(text2);
- d.show();
- //[ ... perform proximity alert actions ... ]
- }
- }
Parsed in 0.037 seconds, using GeSHi 1.0.8.4
Can anyone suggest a better way to set up the proximity alerts so that they dont all fire when when proximity is fired? or point out where the mistake is in my code?

