Identify handset without user having to create account

110 views Asked by At

I am developing an Android app (and soon iPhone app). I need a way to identify the handset from server side. I was thinking I could write a secret (a cryptographic string of some sort) in persistent storage on the device the first time the app is run, and use this to identify the handset next time it speaks to the back end server. Is this how to do it? Is there a better way?

Clarification: The question should have said, I want to identify the user of the app. I'm not interested in tracking the actual device.

1

There are 1 answers

2
Darpan On

As much I understood your question, you wish to identify from which device request is coming, not the build or firmware of the phone. In this case you could identify them from their IMEI number, with following code -

TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
telephonyManager.getDeviceId();

Add the following permission into your Manifest file :

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>