2

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.

  1. Here is what I want to do, and need you to tell me if you think:

    • it's possible this way
    • it's good way of doing it
    • If there is a better way, what is it
  2. So, my goal is to make a wrapper that will allow me to:

    • pop a webview to my game portal
    • get the UID of the user and send it to the game portal
    • be able to get a callback from the web portal (with javascript)
    • Register locally information about user rights (like a status, and an "end subscription date") and check them at launch

Adding to this all sort of logic like, "if I get this reponse from the game portal callback, then I close the webview".

  1. This is how I think doing it:

    • Taking a game in which I have source code
    • Write all the code requested above in Java, putting everything in one single class
    • Set up all calls in methods that will always exists in every APK(mainactivity - onCreate() for example)
    • Compile my apk
    • Decompile my apk with a tool like APK Studio that will produce some readable SMALI code
    • 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)
    • Copy this code part into an other classic compiled/decomplied APK
    • Recompile the APK

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.

Thanks in advance :)

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 ?

And Row ID
  • 169
  • 11

1 Answers1

0

I've been able to solve it by myself. So It may not be the BEST way of accomplishing this. But it the only one I know. So for thoses who'll wonder. Here is some details.

So basically you just need to follow the process I exposed. Except that in my first idea, I planned to call stuff from games main activities.

But in the end, the best thing to do is to make your own main activity that will handle everything needed and from there, pass the actual game mainActivity to some init method for your "wrapper". And you will be able to start the game when you need to.

Also you need to "steal" the main activity property in the manifest for your activity to get started in a first place.

Set up clear call in your mainActivity like 'init(Context,main_act)' so it will be easy to update SMALI.

About layouts & res, you can easilly add them into decompiled apk.

Hope this help someone ;)

And Row ID
  • 169
  • 11