草庐IT

new_location

全部标签

android - 尽管在 list 文件中指定了权限,但 ACCESS_FINE_LOCATION SecurityException

我的应用正在尝试访问设备的位置,并且我在AndroidManifest.xml中包含了以下内容:我已经按如下方式实现了GoogleApiClient.ConnectionCallbacks以访问位置服务:publicclassBackgroundLocationServiceimplementsGoogleApiClient.ConnectionCallbacks,GoogleApiClient.OnConnectionFailedListener{privatestaticfinalStringTAG=BackgroundLocationService.class.getSimple

android - 蓝牙网关 : negotiating new MTU succeeds but new size cannot be used (3 bytes difference)

我正在开发一款使用BLE在设备之间交换数据的应用程序。为了获得更好的性能,在连接两个设备后,我正在协商增加MTU,以便通过BLE交换更大的数据包。连接BluetoothDevice并读取所有服务和特征后,我请求使用以下方法增加MTU:privatevoidrequestMtu(){//gattisaBluetoothGattinstanceandMAX_MTUis512this.gatt.requestMtu(MAX_MTU);}之后,在BluetoothGattCallback实现中,我成功获得了MTU请求,并且新的MTU与我请求的匹配:@OverridepublicvoidonMt

android - 更新android SDK : install latest platform to implement new APIs such as "ShortcutManager"

这里我正在执行Android快捷方式的演示,在androidnougat中引入AppShortcuts我使用以下代码创建了应用程序快捷方式ShortcutManagershortcutManager;if(android.os.Build.VERSION.SDK_INT>=android.os.Build.VERSION_CODES.M){shortcutManager=getSystemService(ShortcutManager.class);ShortcutInfoshortcut;if(android.os.Build.VERSION.SDK_INT>=android.os.

android - 使 Fused Location Provider LocationClient 更易于使用

假设我的应用程序中有5个不同的Activity,它们希望使用LocationClient.getLastLocation()获取最后已知位置。这看起来很简单。理想情况下,我会在每个Activity中创建一个LocationClient并调用getLastLocation()。但是,连接到GooglePlay服务还需要做一些额外的工作,例如调用LocationClient.connect()并处理onConnected、onDisconnected和onConnectionFailed回调。文档在这里:https://developer.android.com/training/loca

android - "Dagger will inject those fields if requested, but will not create new instances"是什么意思?

在Dagger2的文档中,它说Ifyourclasshas@Inject-annotatedfieldsbutno@Inject-annotatedconstructor,Daggerwillinjectthosefieldsifrequested,butwillnotcreatenewinstances.Addano-argumentconstructorwiththe@InjectannotationtoindicatethatDaggermaycreateinstancesaswell.它如何注入(inject)字段但不创建新实例?有什么区别? 最佳答

android - ACCESS_FINE_LOCATION 在 list 中被授予,但总是被拒绝许可?

我目前正在尝试获取用户当前位置的纬度和经度。我在list中启用了以下权限。TargetSDK和minsdk都是23为此,我了解我需要对权限执行运行时检查。但是,当我执行以下操作时,我总是得到-1作为返回。(PERMISSION_DENIED)intpermissionCheck=ContextCompat.checkSelfPermission(getApplicationContext(),Manifest.permission.ACCESS_FINE_LOCATION);尝试访问当前位置时是否遗漏了一个步骤?完整代码在这里:privateStringgetZipcodeFromCu

android - 更新到 New Android Studio 3.2 后出现错误

AndroidresourcecompilationfailedOutput:C:\Users\Desktop\Pulse-AR\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2381:error:innerelementmusteitherbearesourcereferenceorempty.C:\Users\Desktop\Pulse-AR\app\build\intermediates\incremental\mergeDebugResources\mer

java - New PhoneGap 3.0 无法解析import org.apache.cordova

我正在使用全能命令行安装新的phonegap3.0。cordovacreatehellocom.example.helloHelloWorldcordovaplatformaddandroid当我在eclipse中打开android项目时,我在HelloWorld.java上收到此错误:Theimportorg.apache.cordovacannotberesolved我想我缺少一个库,但如果安装3.0的唯一方法被认为是命令行,我将如何解决这个问题。 最佳答案 更新:如果您升级到Phonegap3.3,您就不需要再这样做了。更新P

android - 查找位置 : Google Play Location Service or Android platform location APIs

我正在尝试为我的新导航应用程序获取用户位置。我想经常检查用户的位置,它必须是准确的。我使用示例中的以下代码来获取位置。publicclassMainActivityextendsActivityimplementsLocationListener{privateLocationManagerlocationManager;privateStringprovider;privateTextViewa;privateTextViewb;@OverridepublicvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInst

android - 以这种方式使用 AsyncTask : "new AsyncTask(){" is giving me errors

我正在学习GCM上的android教程,该教程使用了一个名为“doInBackground”的函数,并且他们的函数定义如下:privatevoidregisterInBackground(){newAsyncTask(){@OverrideprotectedStringdoInBackground(Void...params){//dostuff}@OverrideprotectedvoidonPostExecute(Stringmsg){//dostuff}}.execute(null,null,null);}但是当我将他们自己的代码复制并粘贴到eclipse中时,它会提示说我没有实