I'm trying to use AllJoyn for my app, but when I'm trying to use code from sample (sample 13), I can't join to session and get error BUS_BLOCKING_CALL_NOT_ALLOWED.
bus.registerBusListener(new BusListener() {
@Override
public void foundAdvertisedName(String name,
short transport,
String namePrefix) {
short contactPort = CONTACT_PORT;
SessionOpts sessionOpts = new SessionOpts();
Mutable.IntegerValue sessionId = new Mutable.IntegerValue();
Status status = bus.joinSession("com.my.well.known.name", //here's error: status = BUS_BLOCKING_CALL_NOT_ALLOWED
contactPort,
sessionId,
sessionOpts,
new SessionListener());
bus.cancelAdvertiseName("com.my.well.known.name",SessionOpts.TRANSPORT_ANY);
}
});
This code is from sample and I have no idea what's wrong with it. Can you help me?
If necessary, here's full code: http://pastebin.com/f1sD7RtK
I'm trying to create new channel and connect to it automatically, without user's participation.
Also I'll be very grateful for any good advices or samples.