gpt4 book ai didi

android - 从 android 4.2+ 的应用程序中读取 android 上所有应用程序的日志

转载 作者:太空狗 更新时间:2023-10-29 15:31:49 25 4
gpt4 key购买 nike

我相信应用程序在 android post 4.2 中读取日志的方式发生了变化。但是我想知道我是否可以从当前版本的 android 的应用程序中读取所有日志,包括来自 logcat 的系统日志?如果是,是否需要一些许可?

最佳答案

除非你 Root ,否则你不能从 Jelly Bean 开始这样做。看这个Android bug report还有这个related discussion .引用:

The change is that third party applications can no longer get the read logs permission, however every app can read the logs containing only the lines they have written, without needing any permission.

Keep in mind that access to the logs has never been part of the SDK, and is still not part of the SDK. If you are relying on it then, even after this change, you run the risk of breaking in the future. (And that is partly why this got lost for documentation, it is not part of the SDK, so there isn't really a place to document it, in fact documenting it would kind-of make it a part of the SDK which we don't want. :p)

Also we really really hope that developers don't take this as license to further abuse the system logs and spew increasing amounts of stuff into it from their app. Log noise has been a continual problem on Android (not just for third party apps, we always struggle to ship the open source platform without a lot of noise), and if things continue to get worse we will probably make further changes to it to better control it.

编辑:如果您可以访问该设备,那么您可以在那里查看日志,甚至可以尝试向您的应用授予上述权限:

adb shell pm grant <pkg> android.permission.READ_LOGS

但对于其他情况你就不走运了(除非你在框架中发现了一个错误)

关于android - 从 android 4.2+ 的应用程序中读取 android 上所有应用程序的日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17977145/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com