我用Telnet.(e)GPS获得了模拟器中的纬度和经度值。
我怀疑没有谷歌地图, 我们能否利用纬度和经度 找到目前的位置。
我用Telnet.(e)GPS获得了模拟器中的纬度和经度值。
我怀疑没有谷歌地图, 我们能否利用纬度和经度 找到目前的位置。
您可以同时使用 GPS 和 Google 地图获取当前位置 。 如果您想要通过 Google 地图获取位置, 那么 plz < a href=" http://marakana.com/s/tumental_android_place_service_example, 311/ index.html" rel = “ nofollow norefrerr'> 显示这个 < / a > 教程。 您可以 < a href=" https://stackoverflow.com/ questions7644063/ getting- 0- 0- for-latitude-and- longtude- while-show- slowing- plent- place- in-map", 见 < a > 上个问题 。
如果您想要在没有 Google 地图的情况下获取位置, 您可以使用位置管理器 。
为了做到这一点,我们需要在 " OnCreate " 方法中添加坠落代码:
/* Use the LocationManager class to obtain GPS locations */
LocationManager mlocManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
LocationListener mlocListener = new MyLocationListener();
mlocManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, mlocListener);
在自定义类 MyLocation Listener 中,使用“界面定位听觉”执行界面。
我们将加入我们的个人位置听众, 这样我们可以超越一些功能来做我们想要做的事。 在我们的案例中, 我们只需打印一个信息 给屏幕, 在坠落的案例中:
onLocationChanged ( Location Update )
onProviderDisabled ( GPS Off )
onProviderEnabled (GPS On )
并增加另一种强制方法,它不会起到任何作用。
onStatusChanged (We are not adding nothing here).
之后,AdroidManifest.xml文件允许:
android:name="android.permission.ACCESS_FINE_LOCATION"
您可以通过这个代码获得纬度和经度
GPS_Location mGPS = new GPS_Location(MyApplication.getAppContext());
if (mGPS.canGetLocation) {
mLat = mGPS.getLatitude();
mLong = mGPS.getLongitude();
} else {
System.out.println("cannot find");
}
您必须在应用程序中添加 gps 权限和其他权限
I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...
I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...
I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...
I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...
To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?
When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...
I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...
I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...