Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
从我的网站(不是来自市场)分发 APK 时,我想即时嵌入用户特定的数据。
我目前的想法只是在 APK 文件名中嵌入一个唯一的 ID。这很简单,更改文件名不会破坏代码签名。我当前的问题是尝试检索文件名(APK 或 DEX),以便我可以读取此 ID。
我已经尝试了大多数标准方法——探索 PackageInfo、ApplicationContext、ProtectionDomain,但我似乎无法得到任何工作。想法?
APK 文件名在 Android 中没有多大意义。我并不感到非常惊讶,它没有位置PackageInfo。我什至不知道 APK 文件是否以其原始名称存储在设备上。
PackageInfo