IMEI number issue: IMEI number is changing using code - android

I am using a dual Sim phone And sometimes I get different IMEI numbers using the following code:
TelephonyManager manager = (TelephonyManager)
MyApplication.getInstance().getSystemService(Context.TELEPHONY_SERVICE);
String imeiNumber = manager.getDeviceId();
How to resolve this.

As per this question, device manufacturers modify Android to support dual SIMs. However, you can use reflection to get the details of both SIMs.

Related

How to read two IMEI, from Cell phone Dual SIM? (In Android Studio)

I used this line in Android Studio to get IMEI number,
"android.telephony.TelephonyManager.getDeviceId()"
and I can see the first IMEI, but I need see the second IMEI.
Update: I checked this link
Android : Check whether the phone is dual SIM
but I cant resolve the second IMEI.
Try using getDeviceId(int slotId) added in API level 23.
TelephonyManager tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE‌​);
String imeiNumber1 = tm.getDeviceId(0);
String imeiNumber2 = tm.getDeviceId(1);
Requires Permission: READ_PHONE_STATE
IMEI number is depending on your sim slots if you have triple sim mobile there is 3 imei numbers so best way to find out is Check this link Vaibhav Jani naild it
Just add 8 to the last three digits of your first imei number like:
example : 123456789012345 (first imei)
123456789012353 (second imei)

how to find get mobile no and imei no using android apps and display in apps

> how to find get mobile no and imei no using android apps.
I am developing an app for a mobile carrier. First I wanted to find any of the things (IMSI, ICCID, IMEI, MSISDN) so that .
Now as a workaround I will ask the user to register his phone number with my app. But then again bad things will happen if user changes the SIM.
You can give this a try:
TelephonyManager telephonyManager = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE));
String imeiSIM1 = telephonyManager.getDeviceId();;
Refer this For More Clear Information
Hope this could Help
Use following for getting mobile number and IMEI number
TelephonyManager tm = (TelephonyManager)Your_Context getSystemService(Context.TELEPHONY_SERVICE);
// get IMEI
String imei = tm.getDeviceId();
String phone = tm.getLine1Number();
but its not always reliable on for example non phone device. You will also need to add permision "android.permission.READ_PHONE_STATE".

sim number is not getting in android

I used the following code to get to get the sim number and serial number of the sim. But i am getting the sim serial number but not the sim number. I gave the uses permission all the stuffs like that. but i am not getting it.!! Please help me out.!! Thank You.!
TelephonyManager telemamanger = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String getSimSerialNumber = telemamanger.getSimSerialNumber();
String getSimNumber = telemamanger.getLine1Number();
SIM number is not compulsory to be there, it's upto the Telecom if they put number inside the SIM card. It's mostly happen they do it for POSTPAID SIM cards, mostly SIMs do not have number so in that case they return null and if it has, it shall return that NUMBER as it is. To make sure your SIM has number or not, do check that in your android mobile settings.
check this link Check SIM number in android

How to get mobile numbers if my android phone have two SIM cards?

I have implemented an application for get the SIM cards mobile numbers from my Google Ebony QWERTY touchscreen.In this device i have two SIM cards.I have used TelephonyManager for get mobile number from device as follows
TelephonyManager tMgr = (TelephonyManager) arTnewActivity.getSystemService(Context.TELEPHONY_SERVICE);
String getSimSerialNumber = tMgr.getLine1Number();
Log.v("Device mobile numbers",getSimSerialNumber);
From the above code it will return a single mobile number but If i run in case of Ebony QWERTY dual sim phone then can i get two sim card serial numbers?
please any body help me..
From what I understand the default SDK does not have support to handle dual sim. From this thread it sounds like you have to ask the manufacturer if they have a special SDK that could provide this.
If it's Google they might have some additional SDK stuffed away somewhere? :-)

getting IMSI from android phone?

I am developing an app that requires to get the IMSI. I use:
TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String imsi = mTelephonyMgr.getSubscriberId();
It works for most phones, but a few handsets only return 6 digits instead of 15. Which is wrong.
Anyone knows an alternative way to retrieve the IMSI programatically? Other APIS? methods?
Regards
According to this post you can use
String imsi = android.os.SystemProperties.get(android.telephony.TelephonyProperties.PROPERTY_IMSI);
but SystemProperties is not directly accessible, so you will need to use one of the tricks in the answers for this question: Where is android.os.SystemProperties
You may also need SystemProperties source.
first: from Wiki
An IMSI is usually presented as a 15
digit long number, but can be shorter
shorter refers to an older imsi model that was 14 digits. it isn't relevant here
second: it not depends on handset but rather on network
it returns 6 digits because the android software on that particular handset is configured to return only the non-personal identifying part of the imsi - the first 6 digits which define the country and network operator
This code works well in my project.
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
String imsi = telephonyManager.getSubscriberId();
and don't forget the permission:
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

Categories

Resources