模拟器上的 GPS 没有得到地理修复 - Android [英] GPS on emulator doesn't get the geo fix - Android

查看:21
本文介绍了模拟器上的 GPS 没有得到地理修复 - Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为安卓操作系统开发一个应用程序,我才刚刚开始,但我无法让模拟器上的 GPS 工作.我在互联网上读到您需要向模拟器发送地理修复以启用 gps locationProvider.我都在使用 DDMS 和 telnet 来尝试发送它,但是 logcat 从来没有告诉我它收到了一个新的修复程序,而且我的道歉仍然认为 gps 被禁用了

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

这是我的代码

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");   
    }
}

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

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

更新:gps 已在设置中启用

update: the gps is enabled in the settings

推荐答案

原来,因为我是为 Android 1.5(而不是 Google API 1.5)开发的,所以地图(看起来像其他功能)被禁用了.一旦我更改了目标平台,我的错误就消失了.

Turns out, that since I was developing for Android 1.5 (and not Google API 1.5) the map (and looks like other features) were disabled. As soon as I changed the target platform, my error disappeared.

谢谢大家

这篇关于模拟器上的 GPS 没有得到地理修复 - Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆