android - 在 Android 2.3.1 和 2.3.3 上获取 GPS

标签 android gps osmdroid openstreetmap

我在 Android 模拟器 2.3.1 和 2.3.3 中捕获 GPS 坐标时遇到问题,我测试了它,其他版本不明白,在这两个版本的 Android 中不读取坐标,我这样做是为了激活 GPS:

LocationManager lmgr = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

if (!lmgr.isProviderEnabled(android.location.LocationManager.GPS_PROVIDER)) {
        Intent myIntent = new Intent(Settings.ACTION_SECURITY_SETTINGS);
    startActivity(myIntent);
}

lmgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 3000, 10,this);

AndroidManifest.xml

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

通过 logcat 模拟器发送 GPS 坐标,得到以下系统并重启模拟器:

01-16 19:09:09.403: E/InputQueue-JNI(320): channel '406f3310 irbu.lod/irbu.lod.mapa.ViewMapaActivity (client)' ~ Publisher closed input channel or an error occurred.  events=0x8
01-16 19:09:09.403: E/InputQueue-JNI(320): channel '40819c60 irbu.lod/irbu.lod.IRBUActivity (client)' ~ Publisher closed input channel or an error occurred.  events=0x8
01-16 19:09:09.444: E/InputQueue-JNI(115): channel '406479d8 StatusBar (client)' ~ Publisher closed input channel or an error occurred.  events=0x8
01-16 19:09:09.444: E/InputQueue-JNI(115): channel '4063cca0 TrackingView (client)' ~ Publisher closed input channel or an error occurred.  events=0x8
01-16 19:09:09.444: E/InputQueue-JNI(115): channel '40642858 StatusBarExpanded (client)' ~ Publisher closed input channel or an error occurred.  events=0x8
01-16 19:09:09.524: E/InputQueue-JNI(137): channel '407d5158 com.android.launcher/com.android.launcher2.Launcher (client)' ~ Publisher closed input channel or an error occurred.  events=0x8
01-16 19:10:36.427: E/Zygote(363): setreuid() failed. errno: 17

如何在不重启的情况下读取 GPS 坐标?

最佳答案

这是一个错误报告here .

关于android - 在 Android 2.3.1 和 2.3.3 上获取 GPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8885103/

相关文章:

python - 从 24 位有符号转换为纬度/经度?

android - 设置最小和最大缩放级别

android - OSMDroid 离线 map ,带有来自自定义服务器的 zip

Android - 生成截击响应时运行一段代码

android - 如何在对话框中设置 ListView 的 "onItemSelectedListener"。安卓

android - Android 中基于 CelID 的位置?

java - 如何使用 OSMDROID/OSMBonusPack 更改标记气泡

android - 我应该在 Fragment 中的什么生命周期状态下执行异步任务?

android - 在android中将图像从一个 Activity 传递到另一个 Activity

Android 位置管理器问题