gpt4 book ai didi

android - 模拟器上的 GPS 无法获得地理修复 - Android

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:52:52 33 4
gpt4 key购买 nike

我正在为 android 操作系统开发一个应用程序,我才刚刚开始,但我无法让模拟器上的 GPS 工作。我在 Internet 上读到,您需要向模拟器发送地理定位才能启用 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");
}
}

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

更新:在设置中启用了 GPS

最佳答案

事实证明,由于我是为 Android 1.5(而不是 Google API 1.5)开发的, map (看起来像其他功能)被禁用了。一旦我改变了目标平台,我的错误就消失了。

谢谢大家

关于android - 模拟器上的 GPS 无法获得地理修复 - Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/896889/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com