title: Creating an apk wrapper Android (no source code)
body: <p>I'm working in some game portal catalog (kind of a PlayStore) based on a subscription model. I have a partnership with some editor that can provide me some game apks. But not their sources codes. So I have rights to modify stuff about them but I havn't the code.</p>
  
  <ol>
  <li><p>Here is what I want to do, and need you to tell me if you think:</p>
  
  <ul>
  <li>it's possible this way</li>
  <li>it's good way of doing it</li>
  <li>If there is a better way, what is it</li>
  </ul></li>
  <li><p>So, my goal is to make a wrapper that will allow me to:</p>
  
  <ul>
  <li>pop a webview to my game portal </li>
  <li>get the UID of the user and send it to the game portal</li>
  <li>be able to get a callback from the web portal (with javascript) </li>
  <li>Register locally information about user rights (like a status, and an "end subscription date") and check them at launch</li>
  </ul></li>
  </ol>
  
  <p>Adding to this all sort of logic like, "if I get this reponse from the game portal callback, then I close the webview".</p>
  
  <ol start="3">
  <li><p>This is how I think doing it:</p>
  
  <ul>
  <li>Taking a game in which I have source code</li>
  <li>Write all the code requested above in Java, putting everything in one single class</li>
  <li>Set up all calls in methods that will always exists in every APK(mainactivity - onCreate() for example)</li>
  <li>Compile my apk</li>
  <li>Decompile my apk with a tool like APK Studio that will produce some readable SMALI code</li>
  <li>Spot the code part that correspond to my wrapper (by differencing the classic compiled/decompiled apk with the one in which I added the wrapper)</li>
  <li>Copy this code part into an other classic compiled/decomplied APK</li>
  <li>Recompile the APK</li>
  </ul></li>
  </ol>
  
  <p>So I know that I can do everything in the Java part, but I want to be sure that it will be possible to make the "SMALI trick" that I want to use.</p>
  
  <p>Thanks in advance :)</p>
  
  <p><strong>EDIT: I've been wondering, wouldn't it be better for me to create a new Activity that will replace the MainActivity in the smali file and start the real MainActivity throught an Intent call ?</strong></p>