Working Solution:
Main Issue: The API 10 Device i was running (Android 2.3.3) was not correct.
Although it runs properly, it will not receive DDMS mock locations.
Solution: Change API (Android Virtual Device) to : Google Inc Device, API Level 10 (for Android 2.3.3).
Now the DDMS will send locations properly and Google Inc Api Device, will catch locations and display it. Also, the OnStatusChanged method needs toast message. If not, then i'm getting run time crashes (will find out why).
P.S. I know i'm answering my own question, but this was frustrating to deal with. Hence might help someone.
Thank you Greg Shackles for your solutions.
namespace LocationDemo
{
[Activity(Label = "LocationDemo", MainLauncher = true, Icon = "@drawable/icon")]
public class LocationActivity : Activity, ILocationListener
{
private LocationManager _locationManager;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
var welcomeText = FindViewById<textview>(Resource.Id.welcomeMessage);
_locationManager = (LocationManager)GetSystemService(LocationService);
}
protected override void OnResume()
{
base.OnResume();
var criteria = new Criteria();
criteria.PowerRequirement = Power.NoRequirement;
criteria.Accuracy = Accuracy.NoRequirement;
string bestProvider = _locationManager.GetBestProvider(criteria, true);
_locationManager.RequestLocationUpdates(bestProvider, 5000, 20, this);
}
protected override void OnPause()
{
base.OnPause();
_locationManager.RemoveUpdates(this);
}
public void OnLocationChanged(Location location)
{
var locationText = FindViewById<textview>(Resource.Id.welcomeMessage);
locationText.Text = string.Format("Latitude : {0}, Longitude : {1}", location.Latitude,
location.Longitude);
}
public void OnProviderDisabled(string provider)
{
}
public void OnProviderEnabled(string provider)
{
}
public void OnStatusChanged(string provider, Availability status, Bundle extras)
{
Toast
.MakeText(this, "Status for " + provider + " changed to " + status, ToastLength.Short)
.Show();
}
}
}