GPS on emulator doesn#39;t get the geo fix - Android(模拟器上的 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:模拟器上的 GPS 没有得到地理修复 - Android


基础教程推荐
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
- 从 python 访问 JVM 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
- 验证是否调用了所有 getter 方法 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01
- 大摇大摆的枚举 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 多个组件的复杂布局 2022-01-01