Emulator not receiving location ($ reward!)

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

Emulator not receiving location ($ reward!)

Postby dapaintballer331 » Tue Sep 01, 2009 3:07 am

If you can fix this I'm offering $15 (if allowed here).

I have yet to test this on a real phone, so I need help with the emulator.
My problem is this service is supposed to send output to a log, when
the location is changed.
It isn't working, I don't know why. AndroidManifest has permission for
fine, coarse, and mock locations.
I sent locations using (telnet localhost (port), geo fix 12.2321
12.23232) etc AND via eclipse controls.
The service runs the whole time, but the log never receives info from
the onLocationChanged command, but it DOES receive info from onStart,
onCreate, startUpdates, etc.
My service is started via:
Intent myLocService = new Intent(this, FmiLocationManager.class);
startService(myLocService);
-------------------------
Service:
package org.findmydroid;
import android.content.Context;
import android.content.Intent;
import android.app.Service;
import android.location.LocationManager;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
import android.location.Criteria;
public class FmiLocationManager extends Service implements
LocationListener
{
private LocationManager locationMan;
private LocationListener locationLis;
public void onCreate()
{
Log.e("fmi","fmi fmilocationmanager created");
}
public void onStart()
{
startUpdates();
Log.e("fmi","fmi fmilocationmanager started and updates started");
}
public void onStop()
{
stopUpdates();
Log.e("fmi","fmi location updates stopped");
}
public void startUpdates()
{
Log.e("fmi","fmi startUpdates in locationmanager called");
locationMan = (LocationManager) getSystemService
(Context.LOCATION_SERVICE);
if (locationMan == null)
Log.e("fmi","fmi locationManager is null, bad context?");
String provider;
if(locationMan.isProviderEnabled(LocationManager.GPS_PROVIDER))
provider = LocationManager.GPS_PROVIDER;
else
{
Criteria bestCrit = new Criteria();
bestCrit.setAccuracy(Criteria.ACCURACY_FINE);
bestCrit.setAltitudeRequired(false);
bestCrit.setCostAllowed(false);
bestCrit.setSpeedRequired(false);
bestCrit.setBearingRequired(false);
provider = locationMan.getBestProvider(bestCrit,true);
}
locationMan.requestLocationUpdates(
provider,
12000,
1,
this);
}
public void stopUpdates()
{
if(locationLis != null)
locationMan.removeUpdates(locationLis);
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
public void onLocationChanged(Location loc) {
Log.e("fmi","fmi new location received");
/////////////////////////////?THIS IS WHAT ISN'T EVER
CALLED////////////////////
}
}
}
public void onProviderDisabled(String provider) {
}
public void onProviderEnabled(String provider) {
}
public void onStatusChanged(String provider, int status,
Bundle extras) {
}
dapaintballer331
Junior Developer
Junior Developer
 
Posts: 11
Joined: Wed Jul 01, 2009 2:03 am

Top

Postby dapaintballer331 » Sat Sep 05, 2009 7:59 pm

bump!
dapaintballer331
Junior Developer
Junior Developer
 
Posts: 11
Joined: Wed Jul 01, 2009 2:03 am

Postby yaj786 » Mon Sep 21, 2009 11:42 pm

try this:

dont implement location listener in your public class,

instead just instantiate one at the bottom like this:

private final LocationListener locationListener = new LocationListener(){

/* Put your onLocationChanged method in here */

/* Put the rest of the needed methods here (like onProvidorChanged()) */

}


let me know if it works :)
yaj786
Developer
Developer
 
Posts: 33
Joined: Fri Jul 10, 2009 7:37 am

Postby zehunter » Mon Mar 15, 2010 11:59 am

hi,

i try both solution (implement location listener or instantiate one) and i have the same issue .. first GPS position change is detected, and after that all the rest is not received at all :-(

i'm using SDK 1.5 on emulator.
zehunter
Developer
Developer
 
Posts: 27
Joined: Sun Jan 10, 2010 10:45 am

Top

Return to Map Problems

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 5 guests