5

When I read Google play policy, I have a question in this sentence.

An app downloaded from Google Play may not modify, replace or update its own APK binary code using any method other than Google Play's update mechanism.

This means developsers can't use self-modifying code??

For example, when users run a my app for the first time, my app modify its binary code.

And if I use it, can I upload my app using self-modifying code??

maekchi
  • 55
  • 2

1 Answers1

0

Although the policy doesn't allow, if Google doesn't detect us doing, we are safe.

There are couple of ways to dynamically load binary code AKA DEX file. So at runtime you download updated dex file and run it. It is pretty well-known. You can find some info here http://android-developers.blogspot.sg/2011/07/custom-class-loading-in-dalvik.html

Facebook app does use dynamic class loading as the number of methods in their code exceeds 64K, so they have to split their code into multiple dex files and dynamically load it at run time. So if Facebook can, then I guess we are also good to go.

The following blog by Facebook states the problem they faced and how they solved it https://m.facebook.com/notes/facebook-engineering/under-the-hood-dalvik-patch-for-facebook-for-android/10151345597798920

Krypton
  • 3,337
  • 5
  • 32
  • 52