PeerGroupManager on Android not seeing groups created by PeerGroupManager on iOS

asked 2014-04-20 14:16:35 -0700

updated 2014-04-22 10:52:25 -0700

Greetings all seers! Our iOS app makes heavy use of AllJoyn via PeerGroupManager. We're very happy with the kit, but now that we're porting to Android, we can't get past step one of connecting to the AllJoyn bus by instantiating a PeerGroupManager. I don't have a lot of Android experience so i'm fairly certain the problem is with my setup. We're using Android Studio and API level 19. We built a special liballjoyn_java.so.jar file that looks like this:

$ jar -tf liballjoyn_java.so.jar

(see http://stackoverflow.com/a/18187942/16572 for how Android Studio/Gradle doesn't yet support .so files).

We included both liballjoyn_java.so.jar and alljoyn.jar in our libs directory and when we launch the app, it does seem to load the alljoyn libraries:

04-18 11:02:51.011  12922-12922/com.hydroxphere.xxx D/dalvikvm﹕ Added shared lib /data/app-lib/com.hydroxphere.xxx-1/liballjoyn_java.so 0x41e93788

I instantiate a PeerGroupManager like this:

this.peerGroupManager = new PeerGroupManager(PEER_GROUP_PREFIX, pgListener, busObjects);

where PEER_GROUP_PREFIX is a string that matches the one i use when instantiating the PeerGroupManager on iOS. However, when i inspect the found group names (or any of the group names), they are all empty. If i launch another instance of my iOS app, then it correctly shows the available groups.

Where are some obvious places i can look to figure out why my Android app can't see the iOS ones? Does anyone have any experience setting up Android Studio to work with AllJoyn? Any other debugging tips?

Many thanks.

[Updated with Logs]

I'm adding the log from one of the runs on my Moto X. I snipped out repeating lines with "ERROR IFCONFIG" which i think are related to ICE. There are a few different times where it's trying to connect to the AllJoyn bus which i think is due to the activity getting torn down and recreated. We'll definitely use something more robust once we get this to work.

04-22 09:35:10.841    2503-2503/com.hydroxphere.meetcentral W/ActivityThread﹕ Application com.hydroxphere.meetcentral is waiting for the debugger on port 8100...
04-22 09:35:10.847    2503-2503/com.hydroxphere.meetcentral I/System.out﹕ Sending WAIT chunk
04-22 09:35:11.837    2503-2507/com.hydroxphere.meetcentral I/dalvikvm﹕ Debugger is active
04-22 09:35:11.848    2503-2503/com.hydroxphere.meetcentral I/System.out﹕ Debugger has connected
04-22 09:35:11.848    2503-2503/com.hydroxphere.meetcentral I/System.out﹕ waiting for debugger to settle...
04-22 09:35:12.049    2503-2503/com.hydroxphere.meetcentral I/System.out﹕ waiting for debugger to settle...
04-22 09:35:12.249    2503-2503/com.hydroxphere.meetcentral I/System.out﹕ waiting for debugger to settle...
04-22 09:35:12.450    2503-2503/com.hydroxphere.meetcentral I/System.out﹕ waiting for debugger to settle...
04-22 09:35:12.650    2503-2503/com.hydroxphere.meetcentral I/System.out﹕ waiting for debugger to settle...
04-22 09:35:12 ...
edit retag flag offensive close merge delete


Can you confirm that the Android device has Wi-Fi enabled and is no the same network as the iOS devices? Is the Android app running on the emulator or a device?

bspencer ( 2014-04-21 12:25:13 -0700 )edit

Thanks @bspencer! I can confirm that the Android device is powered on, has wi-fi enabled and is connected the the same wi-fi network that the iOS device is connected to. I've tried it with both the emulator and my Moto X.

Keith Alperin ( 2014-04-22 07:37:58 -0700 )edit

It's not going to work on the emulator. But it should be on a handset. Can you edit your posting to include logs from the android device?

bspencer ( 2014-04-22 10:39:26 -0700 )edit

I updated the question with some logs. Thanks again!

Keith Alperin ( 2014-04-22 10:53:02 -0700 )edit

1 answer

Sort by » oldest newest most voted

answered 2014-04-22 12:35:27 -0700

bspencer gravatar image

Thank you for the log, the issue is due to the Manifest file. You need to open the AndroidManifest.xml and add in the permissions:

<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>

Then you will be able to use the network and will be able to discover the iOS peer sessions.

edit flag offensive delete publish link more


That's it!! 04-22 17:49:17.926 9772-9797/com.hydroxphere.meetcentral I/PeerGroupManager﹕ listFoundGroups(): [MyGroupName] Many, many thanks!

Keith Alperin ( 2014-04-22 15:52:47 -0700 )edit

Glad that resolved the problem.

bspencer ( 2014-04-23 19:21:04 -0700 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2014-04-20 14:16:35 -0700

Seen: 529 times

Last updated: Apr 22 '14