Java me bluetooth device id

Hi,
I am developing an application which require to get unique id of mobile phone for that i am taking Bluetooth id... I searched some codes on google, & tried it on my samsung & micromax mobile phone, but it shows unsupported midlet.
the code is as follows
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.bluetooth.*;
public class UNID extends MIDlet implements CommandListener {
private Display display;
private Command exit;
LocalDevice local;
Alert a;
public UNID() {
display = Display.getDisplay(this);
exit = new Command("Exit",Command.EXIT, 0);
a = new Alert("Local Device");
a.addCommand(exit);
a.setCommandListener(this);
public void startApp() {
try {
// Retrieve the local Bluetooth device object
local = LocalDevice.getLocalDevice();
// Retrieve the Bluetooth address of the local device
String address = local.getBluetoothAddress();
// Retrieve the name of the local Bluetooth device
String name = local.getFriendlyName();
System.out.println(address + name);
a.setString("Address is"+address+" Name is "+name);
display.setCurrent(a);
} catch(Exception e) {
e.printStackTrace();
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
public void commandAction(Command c,Displayable d) {
if(c == exit) {
notifyDestroyed();
destroyApp(true);
PLease help me ......
:)

Are you sure the phone supports the Java ME Bluetooth API? What do you think about using IMEI instead? If so, try bellow keys:
        System.getProperty("phone.imei");
        System.getProperty("com.nokia.IMEI");
        System.getProperty("com.nokia.mid.imei");
        System.getProperty("com.sonyericsson.imei");
        System.getProperty("IMEI");
        System.getProperty("com.motorola.IMEI");
        System.getProperty("com.samsung.imei");
        System.getProperty("com.siemens.imei");
        System.getProperty("imei");Code obtained from http://stackoverflow.com/questions/9861368/knowing-the-network-operator-name-in-j2me
Edited by: Telmo Pimentel Mota on 17/04/2012 11:31

Similar Messages

  • PC as a bluetooth Device and accept input from other devices

    I need to set my PC up as a bluetooth device by use of a bluetooth dongle connected to my PC. I need to have a program running on my PC that will detect other bluetooth devices and connect with them, accept input from them. Please help me do this. anyone got code for this? Thank you a gazillion in advance !! :)

    There's no way to do is with standard Java as far as i know. You'll have to use JNI to use native libraries.

  • Bluetooth device detection

    Hi everyone!
    (I am newb at Java, and im looking for a very simple application (i think), but im not sure how to find what im looking for, i tried sourceforge.net, but i dont know how to run the java source files.)
    What im looking for is an app for PC that searches for bluetooth devices in the area, and logs their MAC address into a file (preferably .xml)
    It should continuously search for devices, and update the .xml file everytime it finds a new device, or an old one dissapears, so i always know what devices are in the area at this excact moment.
    Have you ever heard of such a thing, or do you simply have some good keywords for me to use :) Either way i would be very thankful for your help! :)
    Cheers,
    Lars

    Ok, here is my code a bit more formatted:
    public void run() {
    lock = new Object();
    while (!done) {
      doSearch();
        try {
        thread.sleep(DISCOVERY_LATENCY); //2000ms
        } catch (Throwable t) {}
    * Start a new Device discovery
    synchronized public void doSearch() {
    try {
    //get local bluetooth device
    local = LocalDevice.getLocalDevice();
    //get discovery agent
    agent = local.getDiscoveryAgent();
    //start a new Bluetooth discovery inquiry
    agent.startInquiry(DiscoveryAgent.GIAC,this);
    //we lock the thread and wait the end of the current inquiry
    synchronized(lock) {
        try {
        lock.wait();
        } catch (InterruptedException e) {}
    } catch (Exception e) {}
    *We detected one bluetooth devices
    public void deviceDiscovered(javax.bluetooth.RemoteDevice remoteDevice, javax.bluetooth.DeviceClass deviceClass) {
    try {
    // get the bluetooth MAC address of that device and remove any white space
    String value = remoteDevice.getBluetoothAddress().trim();
    if(checkTable(value) && doneDetection == false)
    doneDetection = true;
    launchHotSpotPage("test");
    } catch (Exception e) {
    System.err.println("BLUETOOH ERROR");
    * The bluetooth discovery inquiry has been completed
    public void inquiryCompleted(int discType) {
    local = null;
    agent = null;
    //We unlock the thread in order to make a new discovery
    synchronized(lock) {
    try {
    lock.notify();
    } catch (Exception e) {
    System.err.println("BLUETOOH ERROR");
    lock = null;
    lock = new Object();
    }

  • Ubuntu and API bluecove : java and bluetooth

    Hi
    Here is my final project I want study worked with bluecove api (java bluetooth technology) and J2ME you guessed I am looking to make contacts and nokia laptop via bluetooth
    then voila I first exposed my equipment:
    hp laptop duel core processor, 200 gig hard drive, 2 GB rowing bone ubuntu 10.10 and set a date and I installed the bluetooth driver that ubuntu recommended me short I followed this short course:
    http://myexp101.wordpress.com/2011/11/11/develop-java-bluetooth-application-under-ubuntu-linux/
    for the library installed on ubuntu bluecove then I tested a small java program:
    http://www.miniware.net/mobile/programs/EchoServer.java
    to see that Bluetooth is enabled and can detect the presence of mobile phone nokia
    I created a test project in eclipse and I joined the library in my project brief bluecove here is the program:
    import java.io.*;
    import javax.bluetooth.*;
    import javax.microedition.io.*;
    public class EchoServer {
    public final UUID uuid = new UUID( //the uid of the service, it has to be unique,
                   "27012f0c68af4fbf8dbe6bbaf7aa432a", false); //it can be generated randomly
    public final String name = "Echo Server"; //the name of the service
    public final String url = "btspp://localhost:" + uuid //the service url
    + ";name=" + name
    + ";authenticate=false;encrypt=false;";
    LocalDevice local = null;
    StreamConnectionNotifier server = null;
    StreamConnection conn = null;
    public EchoServer() {
    try {
    System.out.println("Setting device to be discoverable...");
    local = LocalDevice.getLocalDevice();
    local.setDiscoverable(DiscoveryAgent.GIAC);
    System.out.println("Start advertising service...");
    server = (StreamConnectionNotifier)Connector.open(url);
    System.out.println("Waiting for incoming connection...");
    conn = server.acceptAndOpen();
    System.out.println("Client Connected...");
    DataInputStream din = new DataInputStream(conn.openInputStream());
    while(true){
    String cmd = "";
    char c;
    while (((c = din.readChar()) > 0) && (c!='\n') ){
    cmd = cmd + c;
    System.out.println("Received " + cmd);
    } catch (Exception e) {System.out.println("Exception Occured: " + e.toString());}
    public static void main (String args[]){
    EchoServer echoserver = new EchoServer();
    here is the result of the execution in eclipse:
    Setting device to be discoverable...
    BlueCove version 2.1.1-SNAPSHOT on bluez
    Exception Occured: javax.bluetooth.BluetoothStateException: Bluetooth Device is not ready. [1] Operation not permitted
    BlueCove stack shutdown completed
    Do you have an idea for solving the problem?
    cordially

    As I can judge, it is not just simple XML. An
    ODS-File contains some XML in just one file. It is
    not enough, just to parse it once with an XML. Is
    there any APIs I could use, to read the field values,
    or I have to write it myself?
    I don't know why, but if I google for java api and
    ods, openoffice etc. there is no information I need
    :-((As I said, I've not had the need to do it myself, but as this is one of the primary benefits of the ODF, it shouldn't be too taxing. The format seems to be pretty well documented (try the OO website.....I'm sure theres a developers section), so even if you had to write a parser yourself, I doubt it would be terribly difficult. Sorry I can't be of more help.

  • J2ME - scan for bluetooth devices

    Hello,
    Where can i find an example of how to get (in the console, for example) the active bluetooth devices? I need a java program regarding to this. I know there are some examples, but where can i find a good example in this sense? Can you give me some examples?
    The idea is that i wanna store in a file (local file) all the active devices.
    I don't have a real bluetooth device, but using emulators.
    Thanks!

    Hi everybody, here you'll find a MIDlet code for bluetooth device descovering
    hope it will be helpful
    >> HERE

  • Is there a way to get a log of the bluetooth devices my iphone has been connected to?   My Bluetooth car speaker phone was recently stolen from my car and appears to be on Craigslist.

    Is there any way to get a log of the bluetooth devices my Iphone has been connected to?  I recenly had my Bluetooth Jabra stolen from my car and now a simliar one is on Craigslist.  I'd like to give my connection log to the police before I go and see if my Iphone recognizes the device in question.  Any way to get any type of bluetooth device connection log out of my iphone?

    Your contacts should still be on whatever program you sync your iphone to (i.e. Outlook, address book).
    The iphone is not a stand alone device. It is designed to be synced with a computer. If you have not been syncing with a compatible program, then you are out of luck. Your contacts are not included in the back-up because it is meant to be synced with your computer.
    "Although iTunes backs up most of your iPhone and iPod touch settings, downloaded applications, and other information (Contacts, calendars, notes, images in the Camera Roll), your audio, video, and photo content are not included in the backup."
    http://support.apple.com/kb/HT1414

  • No Bluetooth Device found after BIOS Update

    Product Name and No.: HP dv6516tx
    Operating System: Windows XP
    Error Message: No Bluetooth device found
    Changes Made: Updated BIOS to most recent version F. 5A
    System Information:
    OS Name Microsoft Windows XP Professional
    Version 5.1.2600 Service Pack 3 Build 2600
    OS Manufacturer Microsoft Corporation
    System Name UDAYMITTAL-PC
    System Manufacturer Hewlett-Packard
    System Model HP Pavilion dv6500 Notebook PC
    System Type X86-based PC
    Processor x86 Family 6 Model 15 Stepping 13 GenuineIntel ~1496 Mhz
    BIOS Version/Date Hewlett-Packard F.5A, 3/22/2010
    SMBIOS Version 2.4
    Windows Directory C:\WINDOWS
    System Directory C:\WINDOWS\system32
    Boot Device \Device\HarddiskVolume1
    Locale United States
    Hardware Abstraction Layer Version = "5.1.2600.5687 (xpsp_sp3_qfe.080930-1426)"
    User Name UDAYMITTAL-PC\Uday Mittal
    Time Zone India Standard Time
    Total Physical Memory 4,096.00 MB
    Available Physical Memory 2.23 GB
    Total Virtual Memory 2.00 GB
    Available Virtual Memory 1.96 GB
    Page File Space 4.83 GB
    Page File C:\pagefile.sys
    Problem Description:
    Yesterday I updated my laptop's BIOS to F 5A - latest available on HP Website. Since then I have lost the bluetooth functionality, which was wroking just fine prior to the update. Now the system doesn't find a bluetooth device.
    What I have already done:
    1. Switched back to previous versions of BIOS (available on HP Website coz I didn't note the BIOS version before I updated it). - That didn't work.
    2. Reseated the wireless card - Didn't work.
    3. Manually checked the connection of bluetooth module to the motherboard - Connection was fine but it still didn't work.
    4. Uninstalled the bluetooth driver and reinstalled it (HP integrated module WIDCOM) - still didn't work
    5. Installed HP Wireless Agent - Didn't work
    6. Installed HP Integrated module driver along with HP Wireless Agent - Didn't work
    7. Installed Ubuntu to check if its recognizing the device - Even its not recognizing the device which it used to do earlier.
    8. Sadly there's no BIOS setting in Setup which I can change to correct the bluetooth behaviour (Phoenix BIOS with limited interface).
    After all the research, I am posting this because I am unable to find a sloution to this problem on my own. I request the members to please help.
    Uday

    I got the bluetooth working. Had to dismantle the laptop and found that a small switch was loose.

  • How do I upload the contacts from my iPhone 5S to the Bluetooth device on my Toyota RAV4.  The car manual says to consult the phone's bluetooth instruction manual, but I don't have one.

    How do I upload the contacts from my iPhone 5S to the Bluetooth device on my Toyota RAV4?  The car manual says to consult the phone's Bluetooth instruction manual, but I don't have a manual for that.

    That is very strange... I wonder if it has something to do with the firmware or some sort of error. I haven't ran into this but at the shop I work at I've ran into several firmware errors on iPhone 4 all the way through the 5s. Maybe its something as simple as putting a different part of the code into iTunes... I know you can something of this extent. I would look up error 1669, I know you have tried a number of things but look it up on the forum and see what fixes are available so that you may be able to restore it properly without all this garbage you are running into. Just a thought for you.

  • Why does the on-screen keyboard disappear once a Bluetooth device has been attached?

    Once I've connected a bluetooth device to my ipad 2, the on-screen keyboard disappears and doesn't return until I re-start the ipad.  I've tried this with both a bluetooth keyboard, as well as with a bluetooth pedal, which will do page up, page down, right and left arrows, etc.

    Reset your phone , you wont lose anything. Hold the home and off button down until the apple symbol comes up.

  • Voicemail access number deactivated bluetooth device

    Using my iPhone 4, I can gain access to my voicemail by directly dialing my carrier access code (i.e. *138 in my case) through the keypad AND listen through my bluetooth device.  But when using the "Voicemail" button (leftmost docked button), I can still access my voice mailbox BUT can no longer listen through my bluebooth device.  Strange!  Is there anyway I can change the preset access code stored under the "Voicemail" button?

    if it is the iPhone 4, then *5005*86*xxxxx# where xxx is the nmber you want to programme should work...
    but 4S and 5, unknown... anyone?

  • Since the iOS7.0.2 update to my iPhone 4S, I can no longer choose use of my Bluetooth device if using the power cord to listen to MUSIC or answer my phone (choice of powercord as 'dock,' speaker,

    Since the iOS7.0.2 update to my iPhone 4S, I can no longer choose use of my Bluetooth device if using the power cord to listen to MUSIC or answer my phone (choice of powercord as 'dock,' speaker, & phone only).  Was this former-feature now an oversight??  I'd really appreciate having my Bluetooth once again listed as a choice of  audio option.  Especially considering the battery life is not what it was prior to this update, and requires recharging often.

    Sorry to tell you but unless you have a Retail Apple Store close by, they are the only ones I have found with all the adapters and accessories. I bought an extra lightning to usb adapter the other day to use in my truck. Good luck....

  • I could not pair my bluetooth device with my ipad mini retina display. Is there anyone facing the same problem?

    I could not pair my bluetooth device with my ipad mini retina display.
    My ipad could not detect the bluetooth device. I do not facing this problem with my iphone and my older ipad on the same bluetooth device.Is there anyone facing the same problem?

    Yes I tried pairing with my bluetooth car hands-free set - Not discoverable.
    I tried to pair with my bluetooth headset - Also not discoverable.
    I have no problem with my other apple products my older ipad2 and my current iphone5.
    Just this ipad mini retina display could not discover the above bluetooth device.
    Any idea on how to solve this? Thnaks.

  • TS3048 My early 2009 Mac Pro does not connect via bluetooth to my sound bar or bluetooth mini speakers. Both my wireless keyboard and mouse have no problems connecting. What do I need to do to connect to external bluetooth devices?

    My early 2009 Mac Pro does not connect via bluetooth to my sound bar or bluetooth mini speakers. Both my wireless keyboard and mouse have no problems connecting. What do I need to do to connect to external bluetooth devices?

    I would always have a wired keyboard and mouse on hand (need not be expensive ... any cheap wired devices will work).  "Emergency recovery" procedures can activate features in random order, so the opportunity to select a recovery partition may pass before the wireless devices are recognized.
    That will let you select the "turn on Bluetooth" icon.

  • Have to "Set up Bluetooth Device" for wireless trackpad and keyboard almost every day

    Almost every day when I turn on my MacBook Air in my home office, my Apple wireless keyboard and trackpad do not automatically reconnect. They used to connect just fine when I was in the viscinity, but now (for the past 6 months or so) I almost always have to:
    Bluetooth > Set up Bluetooth Device
    Turn off the keyboard (hold down the power button for several seconds)
    Turn the keyboard back on (hold down power button for several seconds)
    Go through the setup wizard
    Repeat for the trackpad
    Things that don't work:
    Pressing the button on each Bluetooth device
    Restarting each Bluetooth device
    Turning Bluetooth on and off
    Setting the Bluetooth devices as "Favorites"
    Selecting the device from the Bluetooth menu item and clicking "Connect"
    Rebooting my MacBook Air
    Resetting  the NVRAM / PRAM
    Once the device is connected for the day, I do appear to be able to "Disconnect" and then "Connect" again from the Bluetooth menu item. The devices will also automatically reconnect by pressing a button on them. It just appears to lose the "lease" on them or whatever after a little less than a day.
    I'm trying to think of other troubleshooting steps I could take and it just occurred to me that I could try swapping them with the peripherals I use at work (which are possibly newer models, but otherwise identical). Any other suggestions?

    Huzzah! Less than 1 week after finally getting fed up and posting this question, I have discovered the root cause - my wife had been inadvertently stealing my keyboard and mouse connection whenever she turned on her laptop! She's using my hand-me-down MacBook Pro which I thought I had reset, but apparently it remembered its Bluetooth connections.
    I had suspected something similar since I occasionally used the wireless keyboard with my iPad, but had already ruled that out.
    I can't believe I figured this out after 6 months of mild frustration, but just days after posting this question

  • How can i use iobd2 with bluetooth device obd2

    Hi,
    I want to connect an obd2 bluetooth device with my iphone 4S/ipad 3 via bluetooth. My Apple device can't find the bluetooth device. What can I do to solve this Problem? I don't want to buy an android tablet or phone.

    Better a year late than never... There is an answer on Re: I want to connect a obd2 bluetooth device. Do i have to buy an android?

Maybe you are looking for