android device not connecting and not notified

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

creat326
Posts: 87
Joined: 13 Jun 2010, 09:50

android device not connecting and not notified

Postby creat326 » 22 Feb 2011, 11:19

Hi

I have a tcp+udp setup that seems to work perfectly fine on my pc. When I compile and run on my android device (nexus one), I begin the login process and the device stays there forever... "login in". No timeout, nothing.

I went into the server and checked the logs:

22 Feb 2011 08:12:58,802 INFO [SocketReader] bitswarm.core.SocketAcceptor - Session created: { Id: 10, Type: DEFAULT, Logged: No, IP: 80.30.219.236:33175 } on Server port: 443 <---> 33175
22 Feb 2011 08:12:58,802 INFO [com.smartfoxserver.v2.controllers.SystemController-1] v2.controllers.SystemController - {IN}: Handshake
22 Feb 2011 08:12:59,560 INFO [com.smartfoxserver.v2.controllers.SystemController-1] v2.controllers.SystemController - {IN}: Login
22 Feb 2011 08:12:59,563 INFO [pool-1-thread-2] Extensions - {dogfightEx}: LOGIN joaco@bocazas.com%1.3a
22 Feb 2011 08:12:59,848 INFO [pool-1-thread-2] Extensions - {dogfightEx}: UPDATE: passwords matched
22 Feb 2011 08:12:59,853 INFO [pool-1-thread-2] v2.api.SFSApi - Login in, { Zone: Dogfight }, ( User Name: Creative1, Id: 5, Priv: 0, Sess: 80.30.219.236:33175 )
22 Feb 2011 08:14:49,388 INFO [SocketReader] bitswarm.core.SocketReader - Socket closed: java.nio.channels.SocketChannel[closed]
22 Feb 2011 08:14:49,388 INFO [Scheduler1-thread-1] bitswarm.sessions.DefaultSessionManager - Session removed: { Id: 10, Type: DEFAULT, Logged: Yes, IP: 80.30.219.236:33175 }
22 Feb 2011 08:14:49,390 INFO [Scheduler1-thread-1] v2.entities.SFSZone - User: Creative1 was disconnected.
22 Feb 2011 08:14:49,390 INFO [Scheduler1-thread-1] v2.api.SFSApi - User disconnected: ( User Name: Creative1, Id: 5, Priv: 0, Sess: 80.30.219.236:33175 )

So it seems on the server side, it's getting disconnected (i don't know why, since username+pass are fine). It takes a fair amount of time to get that disconnection, so I don't know if it's waiting for an UDP package or what's doing, but the client is not getting notification at all. I even shut down the server and the client is still on "logging in".

why would it work fine on pc and fail on android? same code... TCP+UDP btw.
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 22 Feb 2011, 13:52

If you are using Android via Unity and the C# API, then that is not supported (yet?).

Until someone buys me an Unity Android license (and a phone), I cant test and support it. Personally I dont have any incentive (yet) to buy it.

/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
creat326
Posts: 87
Joined: 13 Jun 2010, 09:50

Postby creat326 » 22 Feb 2011, 14:01

what about iphone? is that supported?

btw, ive been using smartfoxserver 1.x with android for months :/
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 22 Feb 2011, 17:45

Its great to hear that v1 works on Android with Unity. Didnt know.

I simply dont have a personal need for Unity Android license (from all reports, its impossible to even earn back the money for the license). So while it _may_ work, its simply not tested - and it would be unprofessional of me if I supported it at this point in time.

Once I get a need - or when someone gives me the license - I can test and get it working on Android too.

iPhone is supported though out of the box - yep! I even had the FPS demo running on my iPad without any changes. Didnt run well, but it ran!

/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games

Follow on twitter: http://twitter.com/thomas_h_lund
lastowl
Posts: 36
Joined: 12 Aug 2010, 20:56

Postby lastowl » 23 Feb 2011, 22:55

i did some simple tests creating a chat environment across multiple platform and i found android + unity had connection issues but i had to edit some of the connection to get it connecting fine but it was dropped regularly, so i then added an auto-reconnect for it not the best solution but thats why we decided to leave android for now till i can investigate deeper.

i would provide a more detailed information but it depends on your project and it wasn't a stable fix, but i have now returned the android phone we were testing on so i cannot retest anything.

EDIT Looking at your logs you posted try without using a custom extension and does it still happen? i may have an idea if it doesnt
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 24 Feb 2011, 06:39

There is also the option - in case you reeeeeaaaally want Unity and Android before this API supports it (no ETA, no promise) - that you can take the obj-c API for SFS2X and access it from Unity.

/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games

Follow on twitter: http://twitter.com/thomas_h_lund
creat326
Posts: 87
Joined: 13 Jun 2010, 09:50

Postby creat326 » 24 Feb 2011, 08:55

I already managed to make it work for android.
Already running on my game on market place, search for game Dogfight

No change on code. The problem seems to be with the UDP or custom login behavior. I never get an error from udp or the login phase. I believe it happens when UDP port is taken (a previous crash of the application for instance).

A quick workaround I did, was to use a temporary variable to check whether I was in game already. After 10 seconds, I check for the variable, if it's not playing the game, I was obviously not able to log in for whatever reason (who knows which one since I never get an error callback) so I call "disconnect".

--
Joaquin Grech
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 24 Feb 2011, 09:03

Super Joaquin!!! Good you got it working.

The issue might in general be related to some other reports about UDP and reconnecting that I'm investigating in a few days. Been a few reports about issues there lately.

We could try again once I've fixed the reconnection issues with UDP.

Also very interested to hear your experience with sales numbers on android. What I've heard from others its abysmally bad. But always good to hear some fresh numbers if you care to share.

/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games

Follow on twitter: http://twitter.com/thomas_h_lund
creat326
Posts: 87
Joined: 13 Jun 2010, 09:50

Postby creat326 » 24 Feb 2011, 09:06

Yeah, from my experience sales on android are about 1/10 to 2/10 of the iOS

People don't seem to be used to hitting the market place icon, while on ios they are more used to purchasing from the itunes icon. That's my unofficial non-study-conclusive guess.

It makes some money though, it pays for the cost of dev, but it just takes way longer (7 to 10 times more). Hopefully things will improve.
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 24 Feb 2011, 09:08

Right - fits nicely with the numbers I've heard. They were between 1/20th and 1/10th of sales on iOS - even for free ad-supported games.

Guess if you got a small hit, then it makes sense to do Android too

/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games

Follow on twitter: http://twitter.com/thomas_h_lund

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 17 guests