I'm running into a problem and I'm stuck. What I'm doing is the following:
- A user logs on to the server but does not join a room
- The user requests a "quickmatch" thru a serverside extension. If there is a room with user waiting then the user is transfed to that room, otherwise a new room is created.
This works perfectly.
Once in a game room I need the users to send data to the other players in the room. For that I'm using the ObjectMessageRequest object on iPhone and on Android.
Code: Select all
SFSObject bericht = new SFSObject();
bericht.putBool("test", true);
sfsClient.send(new ObjectMessageRequest(bericht));
On iPhone this (similar) code works. On Android I get a NullPointer Exception (see stacktrace below). What is also weird is that on both iPhone and on Android a call to getJoinedRooms returns an empty array. I know however for sure that the users are in the quickmatch room (I can see that on the server admin page).
What am I doing wrong ?
03-02 20:51:58.066: E/AndroidRuntime(554): FATAL EXCEPTION: main
03-02 20:51:58.066: E/AndroidRuntime(554): java.lang.NullPointerException
03-02 20:51:58.066: E/AndroidRuntime(554): at sfs2x.client.requests.GenericMessageRequest.executeObjectMessage(GenericMessageRequest.java:348)
03-02 20:51:58.066: E/AndroidRuntime(554): at sfs2x.client.requests.GenericMessageRequest.execute(GenericMessageRequest.java:160)
03-02 20:51:58.066: E/AndroidRuntime(554): at sfs2x.client.SmartFox.send(SmartFox.java:887)
03-02 20:51:58.066: E/AndroidRuntime(554): at com.pinkie.sfstest.SmartFoxHelper.sendMatchData(SmartFoxHelper.java:106)
03-02 20:51:58.066: E/AndroidRuntime(554): at com.pinkie.sfstest.SFSTestActivity.sendmatchdata(SFSTestActivity.java:69)
03-02 20:51:58.066: E/AndroidRuntime(554): at com.pinkie.sfstest.SFSTestActivity$3.onClick(SFSTestActivity.java:52)
03-02 20:51:58.066: E/AndroidRuntime(554): at android.view.View.performClick(View.java:2485)
03-02 20:51:58.066: E/AndroidRuntime(554): at android.view.View$PerformClick.run(View.java:9080)
03-02 20:51:58.066: E/AndroidRuntime(554): at android.os.Handler.handleCallback(Handler.java:587)
03-02 20:51:58.066: E/AndroidRuntime(554): at android.os.Handler.dispatchMessage(Handler.java:92)
03-02 20:51:58.066: E/AndroidRuntime(554): at android.os.Looper.loop(Looper.java:123)
03-02 20:51:58.066: E/AndroidRuntime(554): at android.app.ActivityThread.main(ActivityThread.java:3683)
03-02 20:51:58.066: E/AndroidRuntime(554): at java.lang.reflect.Method.invokeNative(Native Method)
03-02 20:51:58.066: E/AndroidRuntime(554): at java.lang.reflect.Method.invoke(Method.java:507)
03-02 20:51:58.066: E/AndroidRuntime(554): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-02 20:51:58.066: E/AndroidRuntime(554): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-02 20:51:58.066: E/AndroidRuntime(554): at dalvik.system.NativeStart.main(Native Method)