Question

Sorry if my question could be "silly" but I am new Android programmer. I've wrote the app based on that example: http://developer.android.com/training/location/receive-location-updates.html Everything works fine. It show my current location and I receive location updates. I've added a specific location. When I come in a range of that location only show the text "ERROR".
What I did wrong?

public void firstLocation (View v) {
      final Location loc = new Location ("");
      loc.setLatitude(47.2175723);
      loc.setLongitude(17.1427797);
      loc.setAccuracy(10);

      if (mLocationClient.getLastLocation() == loc) {
              Toast.makeText(this, "SOME INFORMATION",
                    Toast.LENGTH_SHORT).show();
          }
       else
          Toast.makeText(this, "ERROR",
                    Toast.LENGTH_SHORT).show();

      }
Was it helpful?

Solution

What you are looking for is called Proximity Alerts. Proximity Alert gives you notification (triggers piece of code) when you come in or goes out from particular location range.

http://androidmyway.wordpress.com/2012/08/07/proximity-alert-in-android/#more-143 or http://myandroidtuts.blogspot.in/2012/10/proximity-alerts.html

can help you to start.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top