Certain android devices not recieving messages from appwarp server

0 votes
I've recently been working on a mobile game using Unity and the Appwarp plugin, but I have noticed that on certain android devices, the game would not recieve any messages from the server, but was able to connect, and create rooms successfully. After looking into the logcat for the affected devices, the following segments appeared in the log when the game was set to connect to the server and create a room:
E/Unity (31213): Unable to find '_Internal'
E/Unity (31213): 
E/Unity (31213): (Filename: Line: 168)
E/Unity (31213): 
E/Unity (31213): Unable to find 'socket_android'
E/Unity (31213): 
-------------- And on another device, the following was in the log -------------
E/Unity (19494): Unable to find '_Internal'
E/Unity (19494):
E/Unity (19494): (Filename:  Line: 168)
E/Unity (19494): 
D/dalvikvm(19494): Trying to load lib /data/app-lib/om.Prism.AirStorm3D-1/libsocket_android.so 0x419ae528
D/dalvikvm(19494): Added shared lib /data/app-lib/om.Prism.AirStorm3D-1/libsocket_android.so 0x419ae528
D/dalvikvm(19494): No JNI_OnLoad found in /data/app-lib/om.Prism.AirStorm3D-1/libsocket_android.so 0x419ae528, skipping init
I've tested the game on a Nexus 7 2013, HTC One X and NVidia Shield with no problems. I only recently noticed this after testing on a Motoroloa Moto G and Nexus 4, both of which seemed to have problems getting data from the server.
This has been the same for whether useUDP  was turned on or off in the build. 
Any help or suggestions would be greatly appreciated
asked Apr 9, 2014 in AppWarp by josiah (10 points)

1 Answer

0 votes
So it connects and you are able to create rooms... but are unable to receive messages? Can you clarify what these messages are? From a networking point of view, the responses for connect and create room are also messages so its strange that those are delivered but some others are not.

If you have Unity Pro -> you can try using the AppWarpS2Unity.dll asset instead of the mobile one which leverages the native socket library we provide.

Can you share what happens in that case (Unity Pro) on those devices?

Also is it a consistently reproducible problem on those devices?
answered Apr 10, 2014 by shepAdmin (111 points)
Hello again,

Yes, the problem is reproducible on the affected devices when trying to connect to another device for the game. We currently have the free version of Unity, so we are unable to use the suggested .dll to utilize the native socket library.

More information :

When the user chooses to start online play, the game connects to the server (with the appwarp service already initialised at the start of the game) and when successful, it creates a 2 player room to set up the session and then subscribes to it. onUserJoinedRoom then confirms that this user has joined the room that was just created. I am able to then connect to this room with another device successfully as well.

Once the second user connects to the room, onUserJoinedRoom on the first device should be called to indicate the 2nd user has connected to the session, but by viewing the log and debug messages, it looks like this isn't happening, only on the devices I mentioned previously, whereas on the other 3 it works as expected.

Here's further info about the test devices as well:

----------------------------- Works as expected ---------------------------
Nexus 7 2013 [Android 4.4.2 - Stock Android] : Tested on Wi-Fi
- Kernel - 3.4.0-gac9222c
HTC One X [Android 4.2.2 - HTC Sense] : Tested on Wi-Fi & HSPA
- Kernel - 3.1.10-g7f360be
Nvidia Shield [Android 4.4.2 - Stock Android] : Tested on Wi-Fi
- Kernel - 3.4.10-gd447395

---------- Not calling onUserJoinedRoom for 2nd user -------------
Nexus 4 [Android 4.4.2 - Stock Android] : Tested on
- Kernel - 3.4.0.perf-g2cae413
Moto G [Android 4.4.2 - Stock Android] : Tested on Wi-Fi
- Kernel - 3.4.0-gc6fc9e1-00001-gf3bf628
To narrow down the problem -

Can you confirm that you've subscribed successfully to that room id from the said device? So only after you get onSubscribeRoomDone (with success) on the room request listener, can you expect to receive the onUserJoinedRoom notifications.

Also what about onJoinRoomDone()? on the room request listener.. Is this being called on all the devices after you call joinRoom() ?
Yes, onSubscribeRoomDone returns a result of 0 on the affected devices.
onJoinRoomDone then also returns 0 on the same device after successfully subscribing to the room.
Hi - someone on our team has a Google Nexus 4 and we just tested on it and the onUserJoinedRoom notification is being received correctly.
I've since installed the trial of Unity Pro and used the standard appwarp .dll file instead of the mobile one to test the results. The builds of the game created with Unity pro and the new .dll seem to work properly on the previously affected devices. But, because we only have a trial of Unity Pro, we're still aiming to find a solution to the original problem.

Also, before testing Unity Pro, we attempted several tests after disabling other running apps on the phones and found that disabling WhatsApp allowed the game to connect and receive the onUserJoinedRoom event for the second user in the room, before immediately disconnecting again. Would you know if other programs could be conflicting with the socket plugin on android?
That's quite strange. The behavior of both the assets is the same - both do a TCP connect to port 12346 of the server. And if you're using UDP (sendUdpUpdate), they both send datagrams to port UDP 12346 of the server. The only difference between the two is that one uses the .Net sockets (pro) and the other uses native BSD socket (plugin).

Its seems unlikely that WhatsApp in particular is the issue. Maybe the OS on the machine is restricting certain combination of outgoing connections/incoming messages.

As I mentioned, the Google Nexus 4 in our office works fine. Can you try with some other Nexus 4 handset to determine if the issue is only with that particular device?

We'll also test with WhatsApp running in the background on our Google Nexus 4.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com