- Home /
How can I get a Persistent Unique Hardware ID?
Hi,
I wan't to get a Persistent Unique Hardware ID that I will use to encrypt (probably RC4) my game data that I save to disk.
In short I want to encrypt and device lock my save data (serialized) but I need this ID to be persistent (after say an update to their phone) so they don't lose there save data.
Another reason I need this is if I have an in app purchase to remove ads, I want to then be able to save this to disk so I remember it in case the app is offline next time it runs, but I don't want this saved file to be able to then just be copied to anyone and have it work to disable ads (for free).
Does anyone know a way I can get this ID / generate it?
Looking mainly for Android and iOS.
Cheers!
Capture device IDs.
http://stackoverflow.com/questions/2785485/is-there-a-unique-android-device-id
You can also bind it to a particular connection by incorporating the mac address but this can be cloned.
I just found SystemInfo.deviceUniqueIdentifier, does anyone know how persistent / reliable this is?
Answer by sansol · Jun 29, 2015 at 03:58 PM
just an idea:
any reason not to use http://docs.unity3d.com/ScriptReference/SystemInfo-deviceUniqueIdentifier.html ?
although for encrypting you could maybe combine such with your own string (e.g.: "thisappisgreat" or something), so you make it a little harder to decrypt that file.
Yeah I will use this I am thinking, do we know how persistent it is? If they upgrade the version of android on their phone will this ID stay the same?
so are you saying encrypt it with a password that is like salted with the uniqueIdentifier?
i don't know if the id will be persistent after an upgrade of the android version, but by reading the documentation i would say yes. in the documentation: "It is guaranteed to be unique for every device"
as for the encryption, i was suggesting you to not just use the device id for encryption, since that is very easy to obtain. just by adding a fix string hardcoded and combining it to the device id you got a better key for encryption (since someone will need to both get the device id and also find out your fixed string to decrypt).
Answer by AurimasBlazulionis · Jun 30, 2015 at 08:38 AM
Your point of encrypting in app purchases will not really protect from not paying for them. If you use Application.PersistentDataPath then non-root user won't be able to access files. If a guy has root and doesn't want to pay for in app purchases, then 90% chance he will use an app like freedom to trick your app into buying your ad free version. So encryption is not really an option, just a lot of work for you. To really prevent these things you have to have a server hosted which checks if he has paid. Anyways, if you are on Android and offline, you will not get ads, even if you get, dev won't get a single penny for them
If you still want encryption you can use I$$anonymous$$EI on Android: http://answers.unity3d.com/questions/655928/imei-android-1.html
Hi, thanks, yeah I realised that the ads wont work offline anyway, so no point remember while they are offline if they have purchased the add removal, but I also would use the encryption to make it harder for people to skip levels.
I don't think it will be too hard to implement as I already have implemented it. But it might be more of a pain of people losing their level progression if the ID changes.
If people remove the ads for free, its not the end of the world, if it gets to that point, I would be happy with the number of downloads I got :)
TheDiamondPLay can you answer on my question under your post abou RPC saving data? :) It's very important for me
Your answer
Follow this Question
Related Questions
How to make an Android/iPhone background service? 1 Answer
easiest way to do pinch zoom? 5 Answers
Skin mesh model merge (iPhone and android) 2 Answers
Saving game question. 1 Answer