File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java Micro Edition and the fly likes Bluetooth Chat application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Bluetooth Chat application" Watch "Bluetooth Chat application" New topic

Bluetooth Chat application

Abhi Venu
Ranch Hand

Joined: Jul 09, 2009
Posts: 73
This is continuation of my earlier post
I would like to know is there anyway by which a messge can be send to the sender when a message is recieved, i meant identifying sender's connection URL from receieved connection i want a url like this "btspp://localhost:" + SERVICE_ID.toString() + ";name=ChattingService;authorize=false";

A table, a chair, a bowl of fruit and a violin; what else does a man need to be happy?:Einstein
Ashley Burton

Joined: Jul 15, 2009
Posts: 5

I've just started my adventure with jsr-82 so this sollution may not be the best.
StreamConnection is just an interface with a few important methods like openInputStream, openOutputStream etc.
You can try to identify the class implementing this intefrace and find out if it exposes any methods that suit you requirements eg connection endpoints.

Other sollution:
Sending message thread can open input stream(using the same StreamConnection) and read the notfication from message receiver.
Of course message receiver must send the notification by write the output stream(created from the same StreamConnection).

Hope this will help somehow.

Abhi Venu
Ranch Hand

Joined: Jul 09, 2009
Posts: 73

My problem is solved. I used a method to solve it.
While sending message ,senders conncetion URL was appended to the message to be sent ..that is it can be considered as a header appended to the message to be send .
On the receiving end i stripped the message to get the senders address.

It is done as follows

After registering service in the SDDB ie following code is used to get connection URL to this particular service ,which is then assigned to a string sender

// For storing Senders Address in a variable and appending it while sending messages.
ServiceRecord rb= LocalDevice.getLocalDevice().getRecord(myNotifier);
// gets senders connection URL

This is appended with message to be sent delimited by a caharacter. ~
argument passed to message sending thread
new SendMessage(sender+"~"+tosend.getString(),currentrecipenturl)
I agree. Here's the link:
subject: Bluetooth Chat application
It's not a secret anymore!