Skip to content
michiyosony edited this page Apr 20, 2015 · 1 revision

After connecting to the bus, it appears to be necessary to advertise a name before joining a session if the session does not already exist.

alljoynBus.startAdvertisingName(advertiseNameSuccess, advertiseNameFailure, name, port);

####advertiseNameSuccess The first parameter is the success callback.

####advertiseNameFailure The second parameter is the failure callback.

####name The third parameter is a string. It should match the name property of the serviceObject passed to the joinSession method.

####port The third parameter is a number. It should match the port property of the serviceObject passed to the joinSession method.

Note: On some networks, if the session already exists, calling startAdvertisingName() before attempting to join the session vastly increases the chances of getting a session in joinSession's success callback that has a sessionId of 0. (A session with sessionId 0 seems to be unable to call proxy methods.) On the other hand, not calling startAdvertisingName() means that it will not be able to join the session until the app that does advertise its name has.

Clone this wiki locally