问题标签 [android-6.0-marshmallow]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
android - Android Studio v1.3 检查未检查权限使用情况
下图显示了来自相关 Google I/O 2015 视频的静态分析错误消息的示例屏幕截图。(此处链接:https ://youtu.be/f7ihSQ44WO0?t=27m12s )
我希望能够运行相同的静态分析,向我展示我正在开发的应用程序中的所有这些问题区域。然而,我花了整个下午通过 Android Studio 运行各种代码分析,最终使代码库看起来更漂亮,但仍然没有更接近发现如何做我最初想要做的事情。
如果有人能告诉我如何运行有问题的静态分析,那就太好了?
谢谢!
Android Studio 版本:1.3 Android Studio 内部版本号:AI-141.2117773 Android SDK 工具:MNC 修订版 2
android - Android M 权限对话框未显示
我目前正在尝试使我的应用程序适应 Android M 的新权限模型。
我正在收集我需要的所有权限,然后运行
requiredPermissions 拥有我需要的权限,例如android.permission.WRITE_EXTERNAL_STORAGE
.
该例程肯定会执行,因为我在 logcat 中有 Log 行:
但是权限对话框永远不会显示,更不用说调用 onRequestPermissionsResult() 了。
我究竟做错了什么?根据一些教程,我发现我没有遗漏任何东西。我只有用于测试的模拟器,没有物理设备。这是设置中的关于屏幕: 图像
可能值得一提的是:如果我尝试从主屏幕打开已安装应用程序的概述,我只会得到launcher3 has exited
. 我不确定这是否相关。
有人知道它为什么不显示吗?
android - 我们如何区分 Android M 的运行时权限中的从不询问和停止询问?
根据Google的说法,当谈到 M Developer Preview 运行时权限时:
如果您以前从未请求过某个许可,请直接请求
如果你之前问过,用户说“不”,然后用户尝试做一些需要被拒绝权限的事情,你应该提示用户解释你为什么需要权限,然后再继续请求权限
如果您之前问过几次,而用户说“不,并停止询问”(通过运行时权限对话框上的复选框),您应该停止打扰(例如,禁用需要权限的 UI)
但是,我们只有一个方法,shouldShowRequestPermissionRationale()
返回 a boolean
,并且我们有三种状态。我们需要一种方法来区分从不询问状态和停止询问状态,因为我们false
从shouldShowRequestPermissionRationale()
两者中得到。
对于第一次运行应用程序时请求的权限,这不是一个大问题。有很多方法可以确定这可能是您的应用程序的第一次运行(例如,boolean
value in SharedPreferences
),因此您假设如果这是您的应用程序的第一次运行,您就处于从未询问过的状态。
但是,运行时权限的部分愿景是您可能不会预先要求所有这些权限。当用户点击需要该权限的东西时,您可能只会在以后请求与边缘功能相关的权限。在这里,应用程序可能已经运行了好几个月,然后我们突然需要请求另一个权限。
在这些情况下,我们是否应该跟踪我们是否自己请求了许可?还是我缺少的 Android M API 中的某些内容可以告诉我们之前是否询问过?
android - 无法在 Android Studio 1.3 中将 gradle 插件更新为 1.3.0-beta4
在探索 Android“M”附带的新 API 和功能时,我遇到了新的数据绑定框架。因此,我按照Android Authority的分步指南和Android 开发人员的帖子来了解这一点。要使用数据绑定,项目需要 gradle 插件 1.3.0-beta4。但是如果我尝试更新,它会给我这样的错误:
有人可以解释我如何解决这个问题吗?
android-intent - 如何使用代码跳转到设置应用中的管理权限页面?
路径是:
设置 -> 应用程序 ->(在应用程序列表中)XXX 应用程序 -> 权限。
以下是我手动进入“管理权限”页面时的日志。
08-11 02:36:02.327: I/ActivityManager(775): 从 uid 1000 开始 u0 {act=android.intent.action.MANAGE_APP_PERMISSIONS cmp=com.android.packageinstaller/.permission.ui.ManagePermissionsActivity (has extras)}显示 0
而且,我搜索了这两个关键词MANAGE_APP_PERMISSIONS
,ManagePermissionsActivity
在Android“M”preview1的源代码中,都没有找到。
有人可以帮忙吗?
android - Using DataBinding library for binding events
I'm trying to bind events with views in xml using DataBinding Library shipped with Android M. I'm following examples from Android Developers and implementing step-by-step. for the view's attributes like visibility,text its working fine but if I try to bind with onclick, it doesn't work as expected. Here's the sample code that I've tried so far:
MainActivity :
MyHandlers:
I've written only required code to improve readability. Could someone help me on this.
android - Determine when app comes out of idle mode in Android M
Android M has a new feature called App Standby where an app is put into an idle state when it's not being utilized (see docs) and, among other things, its network access is disabled.
I can't seem to figure out a way to determine when the app goes into and out of this state (via a broadcast intent or something of the like) and I really need to as my app relies on having network periodically to check the status of a server.
Can someone help me figure out how to determine when my app goes into and out of idle state?
I've been digging through the M preview 2 source and down through the calls of $ adb shell am set-inactive it appears that there's a AppIdleStateChangeListener
but it appears to only be used internally to Android and isn't exposed to us lowly developers who want to know when our apps can use the internet :-(
android - Does the Android M Doze state have multiple states itself?
I slightly modified this app :https://github.com/commonsguy/cw-omnibus/tree/master/JobScheduler
It set alarms using setExactAndAllowWhileIdle and schedules an alarm to go off every 1 minute and log it.
According to Doze documentation, if this app is running while the phone is in Doze mode, only one alarm should be going off per 15 minutes. I'm not seeing that behavior .
On a a nexus 5 running Android M. After starting the app and the whole alarm scheduling process, I put the phone into Doze using the provided abd commands...
adb shell dumpsys battery unplug adb shell dumpsys deviceidle step adb shell dumpsys deviceidle -h
...From the log, I have seen around 30 minutes of alarms going off once per minute, then finally they are 15 minutes apart for about an hour. Then back to once per minute, and then back to 15 minutes apart. The phone was completely undisturbed during the test.
Does anyone know why this is? I was under the impression that the phone would immediately be in Doze mode after those adb commands , and that the alarms would be going off 15 minutes apart from the start.
Thanks for your help.
android - Android M 奇怪的共享偏好问题
在我运行 Android M Developer Preview 2 的 Nexus 5 上,卸载/重新安装应用程序时,设备正在检索我很久以前存储的共享首选项,例如 boolean isFirstLaunch
。
清除这些的唯一方法是从设备设置中手动进行。
Android M 上的共享偏好行为是否有任何变化?我找不到任何有关此的文档。
或者,Android M Preview 2 ROM 可能存在错误...