This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
how to dynamically get mobile IMEI number in J2me?
is there any way to get IMEI for J2ME supported all devices??i did some googling and find out the below solution but it is for device specific.
Nokia.
System.getProperty("com.nokia.IMEI");
SonyEricsson
System.getProperty("com.sonyericsson.imei");
Motorola
System.getProperty("com.motorola.IMEI");
is there any generic way to fetch IMEI for all devices??
There is no generic method to fetch IMEI for all devices, you have to do it by coding only. You can try it in alternate way like use System class as follows,
System.getProperty(“microedition.platform”);
This will going to return you the name of the host platform or device. In Nokia devices the name consists of “Nokia”, the device model, and software version separated by “/”. There is no space between “Nokia” and the model number nor on either side of “/”. Formally, the syntax of the platform string is: Nokia MODEL_NUMBER “/” SW_VERSION. For example, Nokia6310i/4.42 or Nokia3510i/p1.25.
From the result you can fetch the manufacture and use Switch case to get IMEI by coding,
Related
This question already has answers here:
Programmatically obtain the phone number of the Android phone
(22 answers)
Closed 2 years ago.
In my app i want to show the both inserted sim card mobile number to user in android studio . But i suffer from problem in which , i stuck at getting of second inserted sim mobile number . Help me to solve this.
TelephonyManager - "Provides access to information about the telephony services on the device. Applications can use the methods in this class to determine telephony services and states, as well as to access some types of subscriber information."
Code:
TelephonyManager telephonyManager =(TelephonyManager)getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
//SIM 1 Number
String mSimPhoneNumber1 = telephonyManager.getLine1Number();
//SIM 2 Number
String mSimPhoneNumber2 = telephonyManager.getLine2Number();
This method might returns a null on some phones.
Required Permission:
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
This question already has answers here:
Detect USB Drive in Java
(5 answers)
Closed 2 years ago.
Is there a way to detect all SD Card drives connected to a Desktop computer? In Windows, SD Cards are visually distinct from other devices like built-in hard drives or similar. Is there a way to tell if a drive is an SD Card drive or not?
A Java way of listing all available filesystem roots for example is using the listRoots() method but it cannot tell the filesystem types such as external, internal, OS drive or whatever.
Is this even possible in pure Java?
Note:
I'm not asking to detect the Android phone SD Card since these are the results when searching for my question.
This answer solved it.
Example code:
USBDeviceDetectorManager manager = new USBDeviceDetectorManager();
List<USBStorageDevice> usbStorageDevices = manager.getRemovableDevices();
for(USBStorageDevice usbStorageDevice : usbStorageDevices)
{
System.out.println(usbStorageDevice.getSystemDisplayName());
System.out.println(usbStorageDevice.getDeviceName());
System.out.println(usbStorageDevice.getRootDirectory());
}
I have my SD card, NAS, C: and D: drives connected. The following is printed:
SANDISK (E:)
SANDISK
E:\
As expected, only one result is returned because the SD card is treated as USB due to the USB reader being plugged into my laptop.
This question already has answers here:
Programmatically obtain the phone number of the Android phone
(22 answers)
Closed 9 years ago.
I want to get mobile number of own mobile, for add this part to my application .
I'm searching about this question ,
code is correct on emulator but in device show empty.
public String getMyPhoneNumber()
{
return ((TelephonyManager) getSystemService(TELEPHONY_SERVICE))
.getLine1Number();
}
and :
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
But is it returning empty value. So How can I fetch the phone number detail ?
The method you are using is the only one part of the SDK to do this, and only works on devices where the number is stored on the SIM card, which only some carriers do. For all other carriers, you will have to ask the user to enter the phone number manually, as the number is simply not stored anywhere on the device from where you can retrieve it.
Answer from: Programmatically obtain the phone number of the Android phone
"There is no guaranteed solution to this problem because the phone number is not physically stored on all SIM-cards, or broadcasted from the network to the phone. This is especially true in some countries which requires physical address verification, with number assignment only happening afterwards. Phone number assignment happens on the network - and can be changed without changing the SIM card or device (e.g. this is how porting is supported).
I know it is pain, but most likely the best solution is just to ask the user to enter his/her phone number once and store it."
Your code should be fine, but you need the SIM card to be inserted in the phone. Also, as autocrat noted, if the number is not stored on sim card, you will get an empty string.
EDIT: Also, please check the link provided by Pontus Backlund, there's some good info there.
Go to setting -> about device -> status -> my phone number if my phone number is unknown u won't get mobile number.. because some of the mobile network won't give mobile number..
if my mobile number has number u can get mobile through following code
TelephonyManager tManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
phoneNumber = tManager.getLine1Number();
I obtained the Android serial number by code using
android.os.Build.SERIAL
I then compare it to the serial number found in the Settings menu (Settings-> About device-> Status-> Serial number).
I've tested it, and it seems that on some devices (e.g. Nexus) the two codes are the same, while on others (e.g. Galaxy Note) the two codes are completely different: The Java code returns me a 16-digit alphanumeric (lowercase) code, while on screen I can see an 11-digit alphanumeric (uppercase) code.
How is it possible? Are these two codes the same, or something completely different?
If they are the same, is there a way to convert from one of the two to the other?
Is there a better way to identify the device? I know that I can use
the phone device ID (IMEI, MEID,...), which can be obtained
TelephonyManager tManager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
tManager.getDeviceId();
but not all devices are phones, and not all of them have this code;
The Android ID, retrievable by
Secure.getString(context.getContentResolver(),Secure.ANDROID_ID);
But I cannot find it anywhere in the Settings menu, and I need my user to tell me its code by reading it from the user interface.
The app "Android id" on google play(free) shows different ID's like:
android_ID
android.os.build.serial
telephonyManager deviceID
wifi mac
Is there a way to get a device's unique identification using MIDP2.0?
I assume you need to get the IMEI number of the device.
According to the information I found there is no J2ME method to do that because the Hardware API is different from a one model to another. But the device manufacturers provide APIs to get the IMEI number.
Have a look on following article.
Get device ID