Android 日志事件

发布于 2024-10-03 07:54:34 字数 123 浏览 0 评论 0原文

有没有什么好的方法可以从 Android 中的系统日志获取通知/意图/更改。

Logcat 仅显示系统日志的最新部分,我发现它非常有限,我想将更改从应用程序流式传输到网络服务器等。

/约翰内斯兄弟

Is there any nice to way to get notifications/intents/changes from the systemlog in Android.

Logcat only shows the latest part of the systemlog which I find very limited and I would like to stream the changes to a webserver or such from an application.

/Br Johannes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一袭白衣梦中忆 2024-10-10 07:54:34

如果您的应用需要 android.permission.READ_LOGS,您可以在设备本身上运行 logcat,并且 使用 Process.getInputStream() 读取其输出

我还没有测试过它,但我认为它应该允许检索实时 logcat 输出(前提是您在上面的示例中省略了 -d 选项)。

除了在设备上运行 logcat 之外,我认为没有任何方法可以访问日志或获取有关新消息的通知。

Provided that your app requires android.permission.READ_LOGS, you can run logcat on the device itself, and read its output with Process.getInputStream().

I haven't tested it, but I think it should allow to retrieve live logcat output (provided that you omit the -d option in the example above).

Apart from running logcat on the device, I don't think there's any way to access the log or get notified about new messages.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文