模拟器上的GPS无法获得地理定位 - Android

Mau*_*bon 6 eclipse gps android

我正在为Android操作系统开发一个应用程序,我刚开始,但我无法在模拟器上运行GPS.我已经在互联网上读到你需要向模拟器发送地理定位以启用gps locationProvider.我都在使用DDMS和telnet来尝试发送它,但是logcat从未告诉我它已经恢复了一个新的修复程序,而我的apolication仍然认为gps是禁用的

这是我的代码

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");   
    }
}
Run Code Online (Sandbox Code Playgroud)

我已经读过DDMS可能无法在非英语操作系统上正常工作,但telnet应该可以工作!

更新:在设置中启用了gps

Mau*_*bon 5

事实证明,由于我是为Android 1.5(而不是Google API 1.5)开发的,因此禁用了地图(看起来像其他功能)。更改目标平台后,我的错误就消失了。

顺便说一句谢谢