Error BUS_BLOCKING_CALL_NOT_ALLOWED in AllJoyn

I try to use AllJoyn for my application, but when I try to use the code from the sample ( sample 13 ), I cannot join the session and get the BUS_BLOCKING_CALL_NOT_ALLOWED error.

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 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 an example, and I have no idea what is wrong with it. Can you help me?

If necessary, here is the full code: http://pastebin.com/f1sD7RtK

I am trying to create a new channel and connect to it automatically, without user intervention.

I will also be very grateful for any useful tips or samples.

+4
source share
1 answer

Try calling bus.enableConcurrentCallbacks() before calling bus.joinSession(...) in the foundAdvertisedName method.
This will allow AllJoyn to send an additional callback while the current foundAdvertisedName is still running. Here is a link to the documentation that explains what is happening.

+5
source

Source: https://habr.com/ru/post/1445740/


All Articles