Running multiple "clients" in the same Android app

liortal53
liortal53
edited July 2013 in Native
I'm wondering whether it is possible to run mutiple clients in the same android application.

This means that i will be managing multiple live instances of AndroidNetworkLogic (which in turn means multiple LoadBalancingClient instances).

Should this be possible? or these objects somehow make some "global" assumptions that there will only be a single instance of them?

We're getting an app crash (almost) each and every time we do this.

What we have setup is an app that spins 2 threads, each starts its own AndroidNetworkLogic and calls update() regularly to receive/send events.

It seems that the 2nd call to connect() to the cloud causes a crash.

I've pasted the crash exact log from logcat here: http://pastebin.com/KKbg56XW
Maybe that could assist.

*This was tested on a Samsung Galaxy S4.

Comments

  • Hi.

    We have never tested with multiple instances of AndroidNetworkLogic, so I am not 100% sure about that class, but as it's just a demo class just modify it to your needs.

    Running several instances of the LoadBalancingClient class inside the same app is fine.
    However a current limitation is that if you run them in different threads then you will have to work with locks to assure, that only one of them gets accessed at the same time.
  • Thanks.

    The problem is not AndroidNetworkLogic, but the fact that this class spins its own LoadBalancingClient.

    We are also indeed running each of these on a separate thread, perhaps that is why we experienced the crashes...