草庐IT

gps_unit_location

全部标签

Android M requestPermissions(ACCESS_COARSE_LOCATION),不显示对话框?

AndroidManifest.xml已添加:ActivityCompat.requestPermissions()intpermissionCheck=ContextCompat.checkSelfPermission(this,Manifest.permission.ACCESS_COARSE_LOCATION);if(!(permissionCheck==PackageManager.PERMISSION_GRANTED)){//Shouldweshowanexplanation?if(ActivityCompat.shouldShowRequestPermissionRatio

c# - 如何使用 Xamarin 在 Android 中同步获取 GPS 位置更新?

具体来说,我正在使用Xamarin.Forms进行C#开发,但是在nativeAndroid端编写一个GPS包装器类,该类将通过依赖项注入(inject)在Xamarin.Forms端使用。在大多数情况下,对于Android,C#和Java之间的调用应该是相同的。基本上,我在Android端的Geolocator对象(它实现了ILocationListener)中有这个方法:publicasyncTask>GetGPSData(){gpsData=null;varsuccess=false;varerror=string.Empty;if(!manager.IsProviderEnab

android - 父使用功能 android.hardware.location

在AndroidManifest.xml中父特性的使用(对于uses-feature标签)是否意味着与所有启用的子特性相同?例如是下面的block等于 最佳答案 Doestheusageofparentfeature(foruses-featuretag)inAndroidManifest.xmlmeanthesameasallenabledchildfeatures?事实并非如此。您显示的2个block不相等。然而,情况恰恰相反:如果您声明了android.hardware.location.gps,则自动暗示您也声明了andro

java - 如何在 android 4.4 及更高版本中以编程方式检查我是否打开了 gps?

这个问题在这里已经有了答案:HowdoIgetthecurrentGPSlocationprogrammaticallyinAndroid?(21个回答)关闭5年前。我试过在网上搜索答案,但他们似乎只适用于android4.0及以下版本

android - 如何在android中没有互联网的情况下仅使用GPS获取位置

我只想使用GPS获取位置。我不想在此应用程序中使用互联网和GPRS。我的代码如下;告诉我我哪里错了。代码:packagecom.getlocation;importandroid.app.Activity;importandroid.content.Context;importandroid.location.Criteria;importandroid.location.Location;importandroid.location.LocationListener;importandroid.location.LocationManager;importandroid.os.Bun

android - 在android中启动gps设置屏幕

以下代码在三星设备中启动gps设置屏幕,但在htc设备中它启动设置的安全屏幕。我如何编写代码以便它启动独立于设备的gps屏幕。请帮助是否有任何替代解决方案finalComponentNametoLaunch=newComponentName("com.android.settings","com.android.settings.SecuritySettings");finalIntentintent=newIntent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);intent.addCategory(Intent.CATEGORY_LAUNCH

android - 监控 GPS 状态(如果用户使用通知栏关闭 GPS 则无法检查)

在我的应用中,我需要监控GPS状态,应用只能在GPS开启的情况下运行,如果用户关闭GPS,我会显示“位置和安全”设置。我已经为GPS监控实现了自定义类:publicclassGPSManager{LocationManagermLocationManager;StatusListenerstatusListener;/***@paramContextcontext-contexttogetLocationManagerservice*@paramIGpsStatusClientclient-component,whichwantstoreceiveGPSstatusupdate*/pu

android - GPS 让我只有一个位置,而且永远不会改变 Android

在我的应用程序中,我可以使用GPS,但问题是它总是让我到达相同的位置。每次我从那里检索位置时,它都会给我相同的值。第一次它被获取并且我在线,无线。然后我只带着GPS出去了,即使我在一英里外,位置也是一样的。我启用了3g,但还是一样。我将我的应用程序发送给了我的一个friend,他第一次获得了不同的位置,然后无论他走到哪里,他看到的都是一样的。这是我的代码:publicLocationgetLocation(){try{locationManager=(LocationManager)mContext.getSystemService(LOCATION_SERVICE);//gettin

Android:如何使用 gps 测量距离

我正在尝试制作一个应用程序,它在用户当前位置获取纬度和经度。并计算瞬间,用户行驶的距离是多少公里。“currentLat”和“currentLon”是用户当前的纬度和经度。但是我不知道为“endLat”和“ednLon”设置什么纬度和经度。抱歉我的英语不好。提前致谢。//////////////////////////////////我把它做成了应用程序,但现在只有一个小问题。当我第一次启动程序时,我得到值5536,当我重新启动程序时,我得到正常值0.0再次抱歉我的英语不好。:)感谢你们帮助我,你们是最棒的:)publicclassGpsextendsActivity{TextView

android - 'dump' 方法在 android.location.Location 中做了什么,为什么没有文档?

有一个方法叫dump在Location类中,但它没有与之关联的文档。它具体是做什么的?而且,如果它是已知的,为什么它没有文档? 最佳答案 此处仅用于调试目的。这里是实现的源代码:publicvoiddump(Printerpw,Stringprefix){pw.println(prefix+"mProvider="+mProvider+"mTime="+mTime);pw.println(prefix+"mLatitude="+mLatitude+"mLongitude="+mLongitude);pw.println(prefix