Supported ways to talk to an Android app over the web

Preliminary investigation:
(Already experienced users of ServiceStack for building cloud REST services, now moving on to developing mobile devices. Newbies to android development)

What supported/recommended approaches are there (with ServiceStack) for communicating with a running Android app on a remote/mobile android device?
(I.e. Calling an android device from a cloud service)

We need to instruct the app to do something (in as close-to realtime as possible, latency under 2-3 secs is acceptable).

Would prefer to host a ServiceStack REST service within the Android app if possible, but perhaps other options/constraints I am not aware of.
Can use Xamarin as an option.

Any suggestions?

The natural option would be to use Server Events, if Xamarin.Android is an option then you can use the .NET Server Events Client.

I’ve got it on the TODO list to develop a Java Server Events client so you could handle events in Java/Kotlin but haven’t started on that yet.

I’d also expect embedding a self-hosted ServiceStack to work since Xamarin.Android lets you run full Mono, although that seems like a heavy option.

Ok, so lets say i go with serverevents, and say i want to reuse funq as our IOC container, can you show me how to setup the ioc for the xamarin client the recommended way?

Is it just the same way as for building a ss service? AppHost.Init() etc? Or is it different in some way for a xamarin servicestack
client?

Funq is embedded in ServiceStack, it’s not available as an external dependency and I wouldn’t reference the the server ServiceStack.dll in mobile apps.

Personally I’d avoid using any IOC’s in mobile apps, but this page lists some popular IOC’s that work with Xamarin:

http://arteksoftware.com/ioc-containers-with-xamarin/

I’d go for an IOC that also works with iOS’s NoJIT restrictions, in case you need to share code with iOS later.

Thanks for that confirmation