05-07-2009, 12:10 PM
Join Date: May 2009
Post Thanks: 0
Thanked 0 Times in 0 Posts
| | BlackBerry and J2ME OBex push support
Please Login to Remove!
I was writing a simple J2ME app sending an inventation (Obex push message) to the desired Device according to it's BT Mac address.
It works great on almost all the phones I tried it on, the problem with the BB is that each time I try to search for it's services I have to enter a Pass key for pairing. Even if I guess (correctly) the service on the blackberry I can't send the message without pairing the device before hand.
is there any possible way to bypass the Passkey? to push a message without the pairing process? again, it is possible on each and every other Nokia \ Sony Ericsson \ Motorola devices I tried it on.
Here is the relevent piece of code (read this code assuming the BTMAC and the port are valid. For getting the service URL In the actual code I used the classic way that from some reason would pop up annoying Passkey message before I could reach the service URL):
public boolean SendObexInvitation(String BTMAC, String msg)
port = 'q';
// create the file content
String file_content = new String(FILE_CONTENT1 + msg + FILE_CONTENT2 + NSOF_URL + FILE_CONTENT3);
if (port == 'q')
//create the service URL
String service_url = new String(SERVICE_HEADER + BTMAC + SERVICE_FOOTER + port);
ClientSession cs = (ClientSession) Connector.open(service_url);
HeaderSet hs = cs.createHeaderSet();
// now let's send the connect header
String text = new String (file_content);
Operation putOperation = cs.put(hs);
OutputStream outputStream = putOperation.openOutputStream();
// file push complete
System.out.println("couldn;t make it!");