GPS activation

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

GPS activation

Postby nottix » Wed May 12, 2010 1:15 pm

Hi guys,

i have to activate GPS without launch the Intent.
I saw that locale app can do this. Is there any trick to bypass this mechanism?

Thanks
nottix
Freshman
Freshman
 
Posts: 2
Joined: Wed May 12, 2010 1:10 pm

Top

Postby mdamen » Wed May 12, 2010 11:12 pm

It's done using a background service.
Have a look into that..
mdamen
Freshman
Freshman
 
Posts: 2
Joined: Wed May 12, 2010 11:00 pm

Postby nottix » Wed May 12, 2010 11:17 pm

Which background service? LocationManagerService?
nottix
Freshman
Freshman
 
Posts: 2
Joined: Wed May 12, 2010 1:10 pm

Re: GPS activation

Postby Eagle Eye » Mon May 24, 2010 8:34 pm

LocationManager locMgr = (LocationManager)this.getSystemService(Context.LOCATION_SERVICE);

//set your locationListener here

locMgr.requestLocationUpdates(
LocationManager.GPS_PROVIDER,
0, // set minTime in ms
0, // set minDistance in meters
locListener);

and you must create locListener for e.g.:

Code: Select all
LocationListener locListener = new LocationListener()
{
public void onLocationChanged(Location location)
{
if (location != null)
{
Toast.makeText(getBaseContext(),
"New location latitude [" +
location.getLatitude() +
"] longitude [" + location.getLongitude()+"]",
Toast.LENGTH_SHORT).show();
}
}
public void onProviderDisabled(String provider)
{
}
public void onProviderEnabled(String provider)
{
}
public void onStatusChanged(String provider,
int status, Bundle extras)
{
}
};
Eagle Eye
Junior Developer
Junior Developer
 
Posts: 14
Joined: Sun May 23, 2010 6:38 am

Top

Return to Map Problems

Who is online

Users browsing this forum: Google Feedfetcher and 1 guest