TelephonyManager tm =
(TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
String androidId = Settings.Secure.getString(getActivity().getContentResolver(), Settings.Secure.ANDROID_ID);
Log.d("ID", "Android ID: " + androidId);
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
Log.d("ID", "Device ID : " + tm.getDeviceId());
device_id =tm.getDeviceId();
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
else
{
Log.d("ID", "Device ID : " + tm.getDeviceId());
device_id =tm.getDeviceId();
}
// = android .provider.Settings.Secure.getString (// context.getContentResolver (), android .provider.Settings.Secure.ANDROID_ID);
Log.d("lkutyjglh", device_id);