GPS on emulator doesn't get the geo fix - Android

Posted by MaurizioPz on Stack Overflow See other posts from Stack Overflow or by MaurizioPz
Published on 2009-05-22T08:34:34Z Indexed on 2010/04/25 15:53 UTC
Read the original article Hit count: 460

Filed under:
|
|

Hi I'm developing an application for the android OS, I'm just starting, but I can't get the GPS on the emulator to work. I've read on the internet that you need to send a geo fix to the emulator in order to enable the gps locationProvider. I'm both using the DDMS and telnet to try to send it, but logcat never tells me the it recived a new fix, and my apolication still sees the gps as disabled

here's my code

package eu.mauriziopz.gps;

import java.util.Iterator;
import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;

public class ggps extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        LocationManager l =(LocationManager) getSystemService(Context.LOCATION_SERVICE);
        List<String> li = l.getAllProviders();
        for (Iterator<String> iterator = li.iterator(); iterator.hasNext();) {
	    	String string =  iterator.next();
	    	Log.d("gps", string);
    	}
        if (l.getLastKnownLocation("gps")==null)
            Log.d("gps", "null");   
    }
}

I've read that the DDMS may not work properly on a non english OS, but telnet should work!

update: the gps is enabled in the settings

© Stack Overflow or respective owner

Related posts about android

Related posts about eclipse