草庐IT

Location1

全部标签

Android图像编辑器 Intent : retrieving saved file location

我正在使用ACTION_EDITIntent启动Android图像编辑器以编辑图像:IntenteditIntent=newIntent(Intent.ACTION_EDIT);editIntent.setDataAndType(uri,"image/*");启动带有结果的Intent时,如何检索编辑/保存图像的路径? 最佳答案 IamusingtheACTION_EDITintenttolaunchtheAndroidimageeditorinordertoeditanimage请记住,Android没有图像编辑器。某些Andro

android - 无法设置权限 ACCESS_FINE_LOCATION

我是android开发的新手,现在我很难获取当前用户位置。list:主要Activity:intpermissionCheck=ContextCompat.checkSelfPermission(this,Manifest.permission.ACCESS_FINE_LOCATION);Log.d("Checkifpermission","permissionis:"+permissionCheck);Logd返回权限为:-1我做错了什么?使用AndroidStudio,target-sdk为23 最佳答案 checkSelfPe

android - 从 JUnit 单元测试设置 android.location.Location 对象的参数

我正在尝试对接收android.location.Location对象的函数进行单元测试。但我阻止了,因为我无法为Location对象设置参数。@TestpublicvoidtestLocation(){Locationlocation=newLocation("gps");location.setAccuracy(25F);location.setTime(5123L);System.out.println("Accuracy:"+location.getAccuracy());System.out.println("Time:"+location.getTime());}输出:Ac

android - ACCESS_COARSE_LOCATION 不适用于 Android 6

这个问题在这里已经有了答案:Androidpermissiondoesn'tworkevenifIhavedeclaredit(12个答案)关闭6年前。我按照官方的例子写了这个程序publicclassBluetoothActivityextendsAppCompatActivity{privatestaticfinallongSCANNING_TIMEOUT=5000;/*5seconds*/privatestaticfinalintENABLE_BT_REQUEST_ID=1;privateBleWrappermBleWrapper=null;privatebooleanmScan

android - 当仅请求 COARSE_LOCATION 时,Android 是否仍会使用 GPS 来提取位置?

我想弄清楚我是否真的需要请求ACCESS_FINE_LOCATION。我不需要真正准确的坐标。但是,如果手机信号塔或WiFi不可用,我希望能够从GPS获取位置(精度低也可以)。但是,我无法在Android文档中找到关于此的明确答案。以下是Android文档的内容(ACCESS_COARSE_LOCATION)。它告诉我,请求粗略位置会给我来自“Cell-ID,WiFi”来源的信息,并且请求精细权限将使用GPS,但它没有说明GPS是任何类型的后备,因为只有粗略位置权限是要求。公共(public)静态最终字符串ACCESS_COARSE_LOCATION自:API级别1允许应用程序访问粗略

android - 如何正确提示用户打开 "Improve Location Accuracy"设置?

我的应用程序要求用户在其设置中打开“改进的位置精度”。不幸的是,我无法找出正确的方法来实际进入正确的菜单,并在设置设置后让后退按钮返回我的应用程序。这是我的:privatefuncheckLocationSettingsAsync(){viewModel.launch(Dispatchers.IO){vallocationSettings=client.checkLocationSettings(locationBuilder.build()).asDeferred()locationSettings.asTask().addOnSuccessListener{//locationse

java - 异常 : Attempt to invoke virtual method 'int com.google.android.gms.location.LocationRequest.b()' on a null object reference

我已经阅读了一些相关主题,但未能解决我的问题。由于我处于学习阶段,我正在尝试实现谷歌的定位服务教程。问题是,我没有在代码中的任何地方使用“LocationRequest.b()”,但是当我按下“开始更新”按钮时出现以下错误。该应用程序随后崩溃。请让我知道我做错了什么。错误:Exception:Attempttoinvokevirtualmethod'intcom.google.android.gms.location.LocationRequest.b()'onanullobjectreference具体报错代码位置:protectedvoidstartLocationUpdates(

android - java.lang.SecurityException : Requires ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION permission 错误

我正在开发一个android,我想在其中使用NETWORK_PROVIDER获取用户位置,我没有为此目的使用GPS。我收到以下异常java.lang.SecurityException:需要ACCESS_FINE_LOCATION或ACCESS_COARSE_LOCATION权限我正在使用以下代码。]tx=(TextView)findViewById(R.id.textView1);lm=(LocationManager)getSystemService(Context.LOCATION_SERVICE);lm.requestLocationUpdates(LocationManage

java - Play Location Services getLastLocation 返回 null

我正在尝试监听位置变化,但有时从未调用onLocationChanged回调并且getLastLocation返回null,而Googlemap始终完美运行.注意如果我重新启动我的设备,定位服务将只工作约2天;之后我的应用程序和theSDKexample都没有将在Googlemap仍在运行时运行。这是我的服务代码:publicclassVisitServiceextendsServiceimplementsGooglePlayServicesClient.ConnectionCallbacks,GooglePlayServicesClient.OnConnectionFailedLis

android - 从 android 启用/启动 'Google Setting for Location'

我有一个简单的问题,关于如何在我们的应用程序中启用或启动Google位置设置->访问位置。我说的是谷歌更新的新设置。编辑:IntenttoopengoogleSetting我发现只有这个:Intentsettings=newIntent();settings.setPackage("com.google.android.gms");settings.addCategory(Intent.CATEGORY_LAUNCHER);starrtActivity(settings);但我想打开'AccessLocation',我们可以直接启用位置访问还是使用Intent来打开位置访问。我也查看了