草庐IT

ACCESS_BACKGROUND_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

android - retrofit - I/art : Background sticky concurrent mark sweep GC freed

我正在尝试使用Retrofit发出一个简单的REST请求,但我遇到了很多GC错误。我真的不知道如何解决它。我试图在模拟器上放置更多内存,但问题仍然存在。什么时候进行同步调用Response>response=usersCall.execute();以下异常java.lang.RuntimeException:AnerroroccurredwhileexecutingdoInBackground()android.os.AsyncTask$3.done(AsyncTask.java:309)atjava.util.concurrent.FutureTask.finishCompletio

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

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

java - 在BACKGROUND中通过android AlarmClock类设置闹钟

我正在制作一个应用程序,设置闹钟是其中一项功能。我现在不需要该应用程序作为独立的警报管理器。所以,我通过AlarmClock设置闹钟类的ACTION_SET_ALARM使用以下代码:Intenti=newIntent(AlarmClock.ACTION_SET_ALARM);i.putExtra(AlarmClock.EXTRA_HOUR,hour);i.putExtra(AlarmClock.EXTRA_MINUTES,minute);i.putExtra(ALarmClock.EXTRA_MESSAGE,"GoodMorning");startActivity(i);它可以很好地满

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

android - 谷歌地图 Android API v2 : Is there a quick way to know if there is a Marker at a given location?

我想知道给定的LatLng位置是否有标记。有什么快速的方法可以做到这一点,还是我需要编写自己的函数? 最佳答案 Xavjer的答案是正确的,但如果你有很多标记,你可能想删除循环:Mapmap=...;和:Markermarker=map.get(yourLatLng);if(marker!=null){//justdoit} 关于android-谷歌地图AndroidAPIv2:IsthereaquickwaytoknowifthereisaMarkeratagivenlocation?

Android 非法参数异常 : Wrong state class if the app was background for a period of time

如果我设置应用程序背景,我认为是由于内存不足。日志如下:java.lang.RuntimeException:UnabletostartactivityComponentInfo{com.qingdaonews.bus/com.qingdaonews.activity.RealTime}:java.lang.IllegalArgumentException:Wrongstateclass,expectingViewStatebutreceivedclassandroid.view.View$BaseSavedStateinstead.Thisusuallyhappenswhentwov

Android Location 客户端的提供者

我可以使用LocationClient和LocationRequest获取位置更新或当前位置。但是如何知道位置是否被获取是使用gps提供者还是网络提供者。这是示例代码https://developer.android.com/training/location/retrieve-current.html 最佳答案 显然,在使用LocationClient和LocationRequest时,这是不可能的,因为优先级从源转移到获取location的要求/需要端>。提供者是FusedLocationProvider:Fusedlocati

安卓 5( Lollipop ): Is it possible to make the Background of a Notification transparent?

有什么方法可以让Android中的通知背景透明吗?我通过将RemoteViews与Layout和NotificationCompat结合使用来创建通知:RemoteViewsrv=newRemoteViews(getPackageName(),R.layout.notification_layout);NotificationCompat.BuildermBuilder=newNotificationCompat.Builder(this).setSmallIcon(R.drawable.ic_launcher).setContent(rv);布局的LinearLayout的背景设置为

java - 安卓 5.0 IllegalArgumentException : Service Intent must be explicit: on com. google.android.location.internal.GoogleLocationManagerService.START

我正在尝试检索在我的Activity中调用LocationClient类的方法connect的设备的位置,但是当进行调用时系统崩溃以下异常:**FATALEXCEPTION:mainProcess:com.unipagossales,PID:3833java.lang.RuntimeException:UnabletostartactivityComponentInfo{com.unipagossales/com.unipagossales.app.merchants.MerchantFragmentActivity}:java.lang.IllegalArgumentExceptio