is it possible to run a code block(a method or something similiar) only on my device? it should be a piece of code that I can keep into the public apk but get executed only for me. Thank you very much for your help.
Asked
Active
Viewed 49 times
-1
-
Please clarify—you want to, say, use some unique identifier for your device and conditionally run the code based on that unique identifier? – Arya McCarthy Jun 28 '17 at 20:47
-
Yes, exactly. A simple example would be: when I click on the app it will show a toast message ONLY TO ME. Everyone else will not see that toast message. So, if we want to see it in a pseudo-code way it could be: if(me){Toast.make.....} – Fausto Jun 28 '17 at 20:52
1 Answers
1
Every Android device has a unique device ID. You can find out yours and put it in a conditional if block to display the toast.
Steps
- Find your device Unique device ID and save it (or hard-code it in the code ).
if(device_unique_id == MY_DEVICE_ID)
//show toast
More details on obtaining it are here Is there a unique Android device ID?

wick.ed
- 473
- 7
- 15
-
Thank you, I found a solution by using a device id, but not from that post which force you to put some restrictions on the apk. – Fausto Jun 29 '17 at 20:47