问题
I want to know if it's possible to do the following using an android device.
The user is on his android device browsing a site using the native browser. When the user clicks on an particular link or image; is it possible to get a unique ID from the phone? or write a file to the sd card on the phone? or any means of identifying the device later.
Later when I run a particular application I want to be able to access the information which was stored when the user browsing the website.
I know cookies are out because they allow me to access the information from another application.
help?
回答1:
You can only get user agent (pointing on android device), but no unique ID of the phone. And wouldn't other apps also have access to a file on the sd cart, or have the same phone id?
I'm not really getting your scenario, but as a hack, you can introduce an encryption in this whole thing. Consider the following scenario:
User clicks on the link in your webpage and some unique generated id is stored in the cookies (for example my_unique_id12). Your webpage and you app have both 1 shared decryption key. When you open your app, it takes your cookie, encrypts it with your key (getting some rubbish like shf4r734r7rr374rh%) and sends it to the website, that decrypts the info, gets the unique id (my_unique_id12) and does whatever you want it to do. Other apps will have access to your cookie, but without secret key they won't be able to get any info.
来源:https://stackoverflow.com/questions/4885307/how-to-recognizing-the-device-from-browser-and-retrieve-unique-id