|  |  | 
 |  |  | import android.content.pm.PackageManager; | 
 |  |  | import android.provider.Settings; | 
 |  |  | import android.support.v4.content.ContextCompat; | 
 |  |  | import android.support.v4.content.PermissionChecker; | 
 |  |  | import android.telephony.TelephonyManager; | 
 |  |  | import android.util.Log; | 
 |  |  |  | 
 |  |  | 
 |  |  |         TelephonyManager tm = (TelephonyManager) context | 
 |  |  |                 .getSystemService(Context.TELEPHONY_SERVICE); | 
 |  |  |  | 
 |  |  |         if (ContextCompat.checkSelfPermission(context, | 
 |  |  |         if (PermissionChecker.checkSelfPermission(context, | 
 |  |  |                                               Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) | 
 |  |  |         { | 
 |  |  |             _deviceId = tm.getDeviceId(); |