title: Working on Emulator but not on the real Android device
body: <p>I have made an Android Application which shows a <code>Google Map</code> on the Top Half of the <code>Android Screen</code> and in the bottom half of the Android screen it shows a TextView.</p>
  
  <p>And on my <code>Google Maps(on the Top half of the android screen)</code>, I am drawing a <code>Circle</code> on my current location, and I am passing my <code>current location (lat and long values)</code> from the <code>DDMS perspective in the emulator</code>. And it is working fine in the emulator. </p>
  
  <p>When I launch an application on the emulator, first of all it shows a Google Map on the Top Half of the android screen and in the bottom half, it shows a TextView. And then with the use of DDMS Perspective, I am passing my current location (lat and long values) and after passing, it draws a Circle on my current location on the Google maps.</p>
  
  <p>And everything works fine in the emulator.</p>
  
  <p><strong>Problem Statement:-</strong></p>
  
  <p>But when I am trying the same thing on the real <code>Android Phone</code>, only my <code>Google Maps</code> is getting shown properly on the Top half of the android screen and the TextView on the Bottom Half of the Android Screen. But it is not drawing the <code>Circle on my Current Location</code>. </p>
  
  <p>I am connected to wi-fi on my Android phone. And I don't think so I need to pass the Latitude and Longitude values on the Android Phone, right? It should take the current location automatically right?</p>
  
  <p>Or Is there anything I need to do on my Android Phone?</p>
  
  <pre><code>@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);    
  
      locationListener = new GPSLocationListener();
  
      locationManager.requestLocationUpdates(
              LocationManager.GPS_PROVIDER, 
              0, 
              0, 
              locationListener);
  
      mapView = (MapView) findViewById(R.id.mapView);
      listView = (ListView) findViewById(R.id.mylist);
      mapView.setStreetView(true);
      mapView.setBuiltInZoomControls(true);
  
      mapController = mapView.getController();
      mapController.setZoom(15);
  }
  
  private class GPSLocationListener implements LocationListener {
      @Override
      public void onLocationChanged(Location location) {
          if (location != null) {
              GeoPoint point = new GeoPoint(
                      (int) (location.getLatitude() * 1E6), 
                      (int) (location.getLongitude() * 1E6));
  
              findUsersInCurrentRadius(4,location.getLatitude(),location.getLongitude());
  
              mapController.animateTo(point);
              mapController.setZoom(15);
  
              // add marker
              MapOverlay mapOverlay = new MapOverlay(this,android.R.drawable.star_on,R.drawable.tenm,R.drawable.twentym,R.drawable.thirtym,R.drawable.fourtym);
              mapOverlay.setPointToDraw(point);
              List&lt;Overlay&gt; listOfOverlays = mapView.getOverlays();
              listOfOverlays.clear();
              listOfOverlays.add(mapOverlay);
  
              String address = ConvertPointToLocation(point);
              Toast.makeText(getBaseContext(), address, Toast.LENGTH_SHORT).show();
  
              mapView.invalidate();
          }
      }
  
  
  class MapOverlay extends Overlay {
      private GeoPoint pointToDraw;
      int[] imageNames=new int[6];
  
      public MapOverlay(GPSLocationListener gpsLocationListener,
              int currentUser, int tenm, int twentym, int thirtym, int fourtym) {
          imageNames[0]=currentUser;
          imageNames[1]=tenm;
          imageNames[2]=twentym;
          imageNames[3]=thirtym;
          imageNames[4]=fourtym;
      }
  
      public void setPointToDraw(GeoPoint point) {
          pointToDraw = point;
      }
  
      public GeoPoint getPointToDraw() {
          return pointToDraw;
      }
  
      @Override
      public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) {
          super.draw(canvas, mapView, shadow);
          //---translate the GeoPoint to screen pixels---
          Point screenPts = new Point();
          mapView.getProjection().toPixels(pointToDraw, screenPts);
          //--------------draw circle----------------------
          Point pt = mapView.getProjection().toPixels(pointToDraw,screenPts);
          Paint circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
          circlePaint.setColor(0x30000000);
          circlePaint.setStyle(Style.FILL_AND_STROKE);
  
          int totalCircle=4;
          int radius=40;
          int centerimagesize=35;
  
          for (int i = 1; i &lt;= totalCircle; i ++) { 
              canvas.drawCircle(screenPts.x,screenPts.y, i*radius, circlePaint); 
          } 
          canvas.drawBitmap(BitmapFactory.decodeResource(getResources(),imageNames[0]), (screenPts.x-(centerimagesize/2)),(screenPts.y-(centerimagesize/2)), null);
          super.draw(canvas,mapView,shadow);
  
  
          return true;
      }
  } 
  </code></pre>
  
  <p>And my AndroidManifest.xml file-</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.circlemapandroid"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="3"
          android:targetSdkVersion="8" /&gt;
  
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  
      &lt;application
          android:debuggable="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;uses-library android:name="com.google.android.maps" /&gt;
  
          &lt;activity
              android:name=".ThesisProjectAndroid"
              android:label="@string/title_activity_main" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>