Using java Syntax Highlighting
- public void onLocationChanged(Location loc) {
- if (loc != null) {
- GeoPoint p = new GeoPoint((int) (loc.getLatitude() * 1E6),(int) (loc.getLongitude() * 1E6));
- mapController.animateTo(p);
- mapController.setZoom(17);
- mapView.invalidate();
- locationManager.removeUpdates(locationListener);
- locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,3000,10,locationListener);
- }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
Problem seems to be that when I have the last two lines, although listener works good, my ProximityAlerts don't fire anymore.
Using java Syntax Highlighting
- //the initial call is made here by..
- setProximityAlert(currentRid.latdst, currentRid.longdst, 17);
- IntentFilter intentFilter = new IntentFilter(proximityIntentAction);
- nicksProx=new ProximityAlert();
- registerReceiver(nicksProx, intentFilter);
- private void setProximityAlert(double lat, double lon, int requestCode){
- float radius = 50f;
- long expiration = 600000;
- Intent intent = new Intent(proximityIntentAction);
- pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), requestCode, intent, PendingIntent.FLAG_CANCEL_CURRENT);
- locationManager.addProximityAlert(lat, lon, radius, expiration, pendingIntent);
- }
- public class ProximityAlert extends BroadcastReceiver{
- @Override
- public void onReceive(Context context, Intent intent){
- locationManager.removeProximityAlert(pendingIntent);
- unregisterReceiver(nicksProx);
- if (more){
- setProximityAlert(currentRid.latdst, currentRid.longdst, 17);
- IntentFilter intentFilter = new IntentFilter(proximityIntentAction);
- nicksProx=new ProximityAlert();
- registerReceiver(nicksProx, intentFilter);
- }
- }
- }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


