that is code to send file from pc to phon but it dont run and throw
that exception

java.io.IOException: Device not discovered

i dont know what is the problem

try {
   String adr ="btgoep://000E6D80ABBE:9" ;
   System.out.println("addres");
   ClientSession cs = (ClientSession)OBEXConnector.open(adr);
   System.out.println("opening");
   HeaderSet hs = cs.connect(cs.createHeaderSet());
   System.out.println("created header set");
   byte text[] = "Test Message from
avetanaBlueooth".getBytes("iso-8859-1");
   hs.setHeader (HeaderSet.NAME, "ana.txt");
   hs.setHeader (HeaderSet.TYPE, "ana");
   //hs.setHeader(0x49, text);
   System.out.println("putting....");
   Operation po = cs.put(hs);
   System.out.println("put....");
   po.openOutputStream().write(text);
   po.close();
   cs.disconnect(null);
   cs.close();
   System.out.println("closed...");
   } catch (Exception e) { System.out.println(e);

   }

yes i have bluetooth device and work with BlueSoleil stack
then what i can do

import de.avetana.javax.obex.*;
import de.avetana.obexsolo.*;

public static void main(String[]args){

try {
   String adr ="btgoep://000E6D80ABBE:9" ;
   System.out.println("addres");
   ClientSession cs = (ClientSession)OBEXConnector.open(adr);
   System.out.println("opening");
   HeaderSet hs = cs.connect(cs.createHeaderSet());
   System.out.println("created header set");
   byte text[] = "Test Message from
avetanaBlueooth".getBytes("iso-8859-1");
   hs.setHeader (HeaderSet.NAME, "ana.txt");
   hs.setHeader (HeaderSet.TYPE, "ana");
   //hs.setHeader(0x49, text);
   System.out.println("putting....");
   Operation po = cs.put(hs);
   System.out.println("put....");
   po.openOutputStream().write(text);
   po.close();
   cs.disconnect(null);
   cs.close();
   System.out.println("closed...");
   } catch (Exception e) { System.out.println(e);

   }
}
This article has been dead for over six months. Start a new discussion instead.