3
I’m using this code to catch the ID of the device Android.
TelephonyManager telephonyManager = (TelephonyManager) getActivity().getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);
id = telephonyManager.getDeviceId();
But now I’ve noticed that in some cases, the ID was recorded as null
.
- I’m not sure about getting the ID thus?
- Under what circumstances does this return null?
Take a look at this link... http://stackoverflow.com/questions/7514163/using-telephony-manager-in-android-to-find-imei-number
– Jefferson Rudolf
So.. according to the link is right. It is a way to get the IMEI from the mobile. In the table where these Inserts were made I discovered some 15 cases where this value came null. Now I need to find out in which cases this happens.
– Reginaldo Rigo
It depends somewhat on its purpose of use. I suggest reading this article : https://developer.android.com/training/articles/user-data-ids.html But I warn you that there is a unique identifier generated at the time of installation that is registered on Google servers. This may suit you. See https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID
– Rafael