Android: TelephonyManager.getSimSerialNumber() returns null

Vincenzo picture Vincenzo · Apr 5, 2011 · Viewed 10.5k times · Source

in which cases this method returns a null reference? Can only depend on the sim card? Doesn't exist, in these cases, an alternative to retrieve an identification number of the latter?

Thanks to all!

Answer

Nandagopal T picture Nandagopal T · Apr 9, 2011

Please make sure whether you have added the following permission in the Android Manifest, if not please add this statement add try again.

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

Note: Add this permission tag outside the application tag..

Sample Snippet:

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

All the Best