V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
RichardY
V2EX  ›  Android

Android 有没有办法用一段代码生成 content uri

  •  
  •   RichardY · May 15, 2022 · 12658 views
    This topic created in 1456 days ago, the information mentioned may be changed or developed.
    想要通过简单的代码达到:
    根据一个文件的本地路径生成一个 content uri ( content://xxxx.xxx/xxx.xx 这种形式)
    如果能用 shell 生成的话更好了。
    2 replies    2022-05-16 10:57:16 +08:00
    AoEiuV020CN
        1
    AoEiuV020CN  
       May 16, 2022
    > 根据一个文件的本地路径生成一个 content uri
    这不就是 FileProvider.getUriForFile 的使用场景吗?
    content 是对应 provider 的,provider 对应一个安卓应用,纯 linux shell 命令不涉及安卓应用应该没办法生成可用的 content uri 的,
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2899 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 15:30 · PVG 23:30 · LAX 08:30 · JFK 11:30
    ♥ Do have faith in what you're doing.