0

I have one of those questions which are hard to be asked or answered in a forum. Recently I have been tasked with designing (and implementing) an application which would run on android OS. Since I come from the .net world, I decided to use Xamarin.Android framework (previously known as mono for android). I did some research on the target framework and come up with a rough design. But since I am new to android world, I am not sure my design is the best one(ore even an acceptable one). I will try to be as brief with my description as I can. The basic requirements for the application are:

  • The application must be capable of providing different GUI to different users.
  • The application must display data fetched from the server.
  • The application must provide means for a user to modify the server data.
  • When one of the users modifies the server data other users must be notified.

Based on my research I come up with the following:

To provide customized GUI for each user, the application would first authenticate the user than retrieve a xml file from the server which would be than used to programmatically build the GUI. Since I have to support the device rotation and different devices this means a lot of work, so any thoughts on this would be very welcome.

I think the best way for the application to communicate with the server is by calling the REST based services(GET to retrieve the initial data and PUT to update the server state).

When the server state will be modified by one of the users, all other users will be notified using notifications(Google cloud messaging or GCM which replaced the old C2DM). Since most of the activities would rely on notifications to display updates I think the best way to implement this is to create an android service. The service would be started with the application and would run as long as the application. When the service would be started it would register it self with the GCM and than use broadcasts to notify the current activity that something has changed.

I apologise for a long post but I tried to be as brief as I could. As I said, this is a very rough design so any thoughts, ideas or criticism would be very welcome.

Uroš

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Uroš
  • 169
  • 1
  • 10

1 Answers1

0

I'd be more inclined to transport/handle the GUI configuration as JSON.

REST API seems the logical choice - I've used RestSharp for the client side to do these kind of comms and I'm pretty happy with it.

GCM is a snap to set up, so it's a good choice. You might also consider a custom long-polling solution depending on your needs, but GCM aught to be easier.

PushSharp might be worth a look if you need cross-platform push notifications, but if you don't, writing your own GCM server application is like falling over - I got a scratch example working with a couple dozen lines of Ruby.

manadart
  • 1,750
  • 11
  • 13
  • Thanks for your answer. I intended using the PushSharp library since it is quite possible that the app will some day run on IPhone too, so I will use the same library to notify those clients. I will take a look at RestSharp library. Can you point me towards any examples of how to implement the GUI genereation using xml / json. – Uroš May 17 '13 at 07:38
  • I guess you'll have a JSON/XML document per user and activity that creates any dynamic content using a technique something like this: http://stackoverflow.com/questions/6216547/android-dynamically-add-views-into-view – manadart May 20 '13 at 08:29
  • Was this answer helpful? ;) – manadart Sep 10 '13 at 18:23