Here's my getIMEI function:
public static String getIMEI(Context c){
TelephonyManager telephonyManager = (TelephonyManager) c
.getSystemService(Context.TELEPHONY_SERVICE);
return telephonyManager.getDeviceId();
}
The problem is that for all devices with API >= 26 the
getDeviceId()
method is deprecated. My question is how do I make my function to work for all APIs. Is there an alternative to getDeviceId() ?