sheik,
I have ADP1. I have tested that code(have added super call)
As far as I understand, this is working fine.
Keiji,
-----------------------------------------------------------------------
public class GPSActivity extends Activity {
// LocationManager
private LocationManager _mLocMan;
// LocationListener Interface
private final LocationListener _mLocationListener = new LocationListener() {
@Override
public void onLocationChanged(Location location) {
// implement here
}
@Override
public void onProviderDisabled(String provider) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras)
{
}
}; // _mLocationListener
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// get Location Manager
_mLocMan
= (LocationManager)this.getSystemService(LOCATION_SERVICE);
// register location listener
_mLocMan.requestLocationUpdates(
LocationManager.GPS_PROVIDER,
0,
0,
_mLocationListener);
} // onCreate
@Override
public void onDestroy() {
super.onDestroy();
// unregister location listener
_mLocMan.removeUpdates(_mLocationListener);
} // onDestroy
} // GPSActivity
-----------------------------------------------------------------------
sheik wrote:
> Thank you for your response...
>
> I have been using the some wat same code to run in the emulator and
> it works fine as you have mentioned in response....
>
> My actual doubt was that, does it work in the ADP1 as i dont have
> handson G1 or the DEV PHONE......
>
> I like to know .....Have u tested above code in the dev phone if it
> has worked well my doubt very much cleared ........
>
> Thank you agin.......
> regards
> sheik
>
> On Feb 19, 11:06 am, Keiji Ariyama <[email protected]> wrote:
>> Hi sheik,
>>
>> Please see below code. And you can see
>> reference.http://developer.android.com/reference/android/location/LocationListe...
>>
>> 1. Implement LocationListener interface.
>> 2. Get Location Manager.
>> 3. Register LocationListener to LocationManager.
>>
>> LocationListener.onLocationChanged(Location location) method is called
>> when GPS can receive location.
>>
>> You can set minimum interval time or distance to work GPS on
>> requestLocationUpdates method.
>>
>> Attention, if LocationListener is once registered, GPS will be being
>> activated basically.
>> You should call to LocationManager.removeUpdates at onDestroy or onStop.
>>
>> Good luck,
>> Keiji
>>
>> -----------------------------------------------------------------------
>> public class GPSActivity extends Activity {
>>
>> // LocationManager
>> private LocationManager _mLocMan;
>>
>> // LocationListener Interface
>> private final LocationListener _mLocationListener = new LocationListener() {
>> @Override
>> public void onLocationChanged(Location location) {
>> // implement here
>> }
>> @Override
>> public void onProviderDisabled(String provider) {
>> }
>> @Override
>> public void onProviderEnabled(String provider) {
>> }
>> @Override
>> public void onStatusChanged(String provider, int status, Bundle
>> extras)
>> {
>> }
>>
>> }; // _mLocationListener
>>
>> @Override
>> public void onCreate(Bundle savedInstanceState) {
>>
>> // get Location Manager
>> _mLocMan
>> = (LocationManager)this.getSystemService(LOCATION_SERVICE);
>>
>> // register location listener
>> _mLocMan.requestLocationUpdates(
>> LocationManager.GPS_PROVIDER,
>> 0,
>> 0,
>> _mLocationListener);
>>
>> } // onCreate
>>
>> @Override
>> public void onDestroy() {
>> // unregister location listener
>> _mLocMan.removeUpdates(_mLocationListener);
>>
>> } // onDestroy
>> } // GPSActivity
>>
>> -----------------------------------------------------------------------
>>
>>
>>
>> sheik wrote:
>>> Hi,
>>> i need to know about the LocationListener() working in the Android
>>> DEV Phone(ADP1)
>>> Does it expect the user(device) to move in order to update the
>>> current location details or it automatically updates when ever the gps
>>> is enabled?
>>> Another query is regarding the getLastKnownLocation().....
>>> When is that last known location will be lost and thus returns null...
>>> (ADP1)...
>>> Thanks,
>>> regards,
>>> sheik
>> --
>> Keiji,
>> [email protected]
> >
>
>
--
Keiji,
[email protected]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---