1

Is there a tool or application that I can use to stamp Android .APK files (on my server, before a download) with a unique number that is queryable at runtime?

Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
dicroce
  • 45,396
  • 28
  • 101
  • 140

5 Answers5

4

A much simpler approach would be to use the phone's identification number:

How to find serial number of Android device?

Community
  • 1
  • 1
Computerish
  • 9,590
  • 7
  • 38
  • 49
  • You don't want to do that! WiFi MAC addresses either. Tablets don't have IMEI numbers. It's a very bad practice. – pjv Mar 31 '12 at 16:57
0

I guess the only option is to use custom Ant build for you app. Then you can build the APK every time you ship it to user, injecting that unique number to the code or resource file. This can eat pretty much of your server's CPU though.

UPD: Also probably the apktool can be useful for the case http://code.google.com/p/android-apktool/ but I'm not sure if that will eat less resources then building from a scratch.

Konstantin Burov
  • 68,980
  • 16
  • 115
  • 93
  • Really? Wow... I have to believe there is another way! I can't be the first person to want to do this! – dicroce Aug 24 '10 at 14:15
0

You'll have to do it before you compile to a apk, which means you can do it however you like! Use the version code, or a variable in res/values. There is no way to do it to an apk you've already compiled (that is ready to be shipped) after it has been signed/zipaligned.

fredley
  • 32,953
  • 42
  • 145
  • 236
0

An .apk is just a zip file, so you can use any zip tools. However, you will need to re-sign the .apk and re-run zipalign after making any changes to it,

hackbod
  • 90,665
  • 16
  • 140
  • 154
0

I think most efficient way is to add a data file to already built apk. Then sign only that one file + manifest. It will take milliseconds, I think, so you could do this "on the fly".

Unfortunately I doubt there is a tool to sign selected files only, you would need to write one.

broot
  • 21,588
  • 3
  • 30
  • 35