开发者

How to protect drawable resource in Android application

开发者 https://www.devze.com 2023-02-09 20:55 出处:网络
Please tell me how to protect our resource in a apk package. With a simple rename-extract process, any one can copy and thief application drawable 开发者_如何转开发resource like images or soundFX file

Please tell me how to protect our resource in a apk package. With a simple rename-extract process, any one can copy and thief application drawable 开发者_如何转开发resource like images or soundFX files. My question is, is there any way to protect drawable resource in a Android application?


The drawable needs to be accessible to the operating system, so it has to be readable.

If you really want to keep it secure, you could consider storing it encrypted as a raw asset, then load it, decrypt it into a ByteStream and pass it into the BitmapFactory. That, of course, has slight performance ramifications and will force you to hand-code a lot of stuff that you could have easily done in XML otherwise.

That all aside, there are many ways to steal data - if it's a drawable, people could just take a screenshot.


My question is, is there any way to protect drawable resource in a Android application?

No. Resources are world-readable by design. Even if you were to not package the "images or soundFX files" as resources but were to download them on first run, users with root access could still get to the files.

Since this is not significantly different than any other popular operating system humanity has developed, it is unclear why you think this is an Android problem. Sufficiently interested users can get at your "images or soundFX files" on iOS, Windows, OS X, Linux, and so on. Even Web apps are not immune.


I think it's possible to protect resources. In fact there's low-level class/routine to read resources: AssetManager - ordinary Resources class sits on top those AssetManager. So to protect resource one can scramble resources and read/unscramble them using AssetManager low-level methods: look here

0

精彩评论

暂无评论...
验证码 换一张
取 消