DropBoxManager use cases?

青春壹個敷衍的年華 提交于 2019-12-03 04:25:25

问题


I noticed that a DropBoxManager has been introduced in Android API since FroYo (API 8).

It looks like an alternative logger capable of logging not only text but also files or byte arrays, but I could not find any detailed doc anywhere about how and when we should use it.

The latest android dev blog post introducing StrictMode talks about it, StrictMode can append data to the DropBox, and we are given a shell command to retrieve these data.

Please share here your knowledge about this! Why has it been implemented in addition to the usual logcat? Can we use this to share data across apps? What kind of apps use it?


回答1:


There are basically three logs on the system:

Log:

  • for short, textual data
  • in-memory ringbuffer, fast
  • ephemeral (you'll lose it on a crash, or the ringbuffer scrolls)
  • intended for app developers

EventLog is:

  • for short, binary data
  • in-memory ringbuffer, fast
  • ephemeral (you'll lose it on a crash, or the ringbuffer scrolls)
  • intended for platform developers to collect statistics

DropBox:

  • for long text or binary data
  • persistent, written to disk
  • kinda slow (disk)
  • meant for platform developers too, mostly to collect crashes & large statistics
  • subject to limits, deleted by tag if a tag's count and/or size get too large

DropBox is what we used during development to capture all the StrictMode violations in Gingerbread.

You can use DropBox for one-off debugging, but it's not really recommended. It's definitely not recommended as a way to share data between apps. It's not reliable enough, and you can't put permissions on the data. You should just use a shared userid and use the normal filesystem with appropriate permissions.



来源:https://stackoverflow.com/questions/4434192/dropboxmanager-use-cases

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!