views:

48

answers:

1

Is there a way to code-sign (to allow it to open only on a device with specific ID) your Android app when using ad-hoc distribution (sending app to testers or clients as a subcontractor)?

I know I can share apk file pretty easily, but what if I don't want other people to redistribute the app before it is ready? I don't want testers to be able to distribute not finished and buggy version of my app for example. Or I would like to show my client the final version of the app, but not allow them to distribute it until the payment is made.

+1  A: 

I did something similar.

Previously i get the IMEI of the tester device

and then on the onCreate() function

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);      

String IMEITesterDevice = "1234123535346453634";

 final TelephonyManager  mTelephony =  (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
    String AndroidDeviceId = mTelephony.getDeviceId();

if (AndroidDeviceId.contentEquals(IMEITesterDevice ) //Not equal then
 super.finish();  //force to finish my app.
...
...
...
}
Jorgesys
I had to add the READ_PHONE_STATE permission, and change comparison to "!AndroidDeviceId.contentEquals(IMEITesterDevice)", but in general the idea is correct, thanks!BTW it's a shame, that the OS can't take care of this and we have to do this kind of checking in code...
Łukasz Sromek
yes very important READ_PHONE_STATE permission to use TelephonyManager class :), thank you.
Jorgesys