0

Can anyone tell me how to fetch the device Id for above api 21 .. i want to fetch both the device id if its dual sim ??

Currently I am using below code

public static String getImeiNumber(Context context) {
    try {
        if (context != null) {
            TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
            if (telephonyManager != null) {
                Log.d(TAG, "Device ID" + telephonyManager.getDeviceId());
                return telephonyManager.getDeviceId();
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

and also above marshmallow how can i get the device ID WITH DUAL SIM ???

witted_coder
  • 161
  • 1
  • 14
  • what you actually want phone nmbr or deviceid? – Abhishek Jun 09 '16 at 08:50
  • Check [this](http://stackoverflow.com/questions/2785485/is-there-a-unique-android-device-id) question please. – Burak Cakir Jun 09 '16 at 08:53
  • DeviceId has nothing to do with sim card. It is a unique number of the phone. You mention dual sim, what exactly do you need to get? – Vucko Jun 09 '16 at 08:58
  • 1
    I got the answer ..Thank You.. @Vucko device Id is nothing but the imei ID and dual sim has two imei's .. thats what i wanted ... found ans here https://developer.android.com/reference/android/telephony/SubscriptionManager.html#getActiveSubscriptionInfoList%28%29 – witted_coder Jun 09 '16 at 09:32

0 Answers0