Android support

27 views
Skip to first unread message

adenaman

unread,
Jul 30, 2012, 12:23:00 AM7/30/12
to moga...@googlegroups.com
I would like to ask you how advanced and completed is android libs, because in your main page there are only Windows phone games, and that scare me a bit. There are some examples in your git section, but again windows phone only, is there anywhere a guide / examples for android?

I am completly lost with how do i send, and more important recive data, because
-i send a request for general scores
-i create a view structure to show the score, but how can i make so when score's data arrive i write it down to the view? if the view still there, because maybe user closed score window before data arrived


One more thing:
there are different leaderboards, but how can i create a country ranking and global ranking (without having 135784 local + 1 general board)? maybe i can add 2/3 chars to user name/ user id, to know where is he from, but how could i sort the scores result when showing some local ranks?

Karl Seguin

unread,
Jul 30, 2012, 2:05:05 AM7/30/12
to moga...@googlegroups.com
The Android library is mostly a community effort, so I'm not sure what state it's in. I'm also not able toa answer your question about view and lifecycle.  I'd assume in your callback (once you got the data), you'd have to find out whether the view you expected still existed or not.

As for geo-specific leaderboards, that isn't possible with mogade.

Karl

Darren Kopp

unread,
Jul 30, 2012, 12:29:11 PM7/30/12
to moga...@googlegroups.com
Android library is functionally complete as of last time I worked on it, though I haven't been able to work on it since and so is missing unit tests still and you have to build from source. There was one person doing something with it but only a couple of aspects and I don't remember what they were, nor do I know if he ever finished. Karl could probably look at logs to see perhaps based on user-agent. It's been a while since I worked on it, so there may be new functionality in the c# driver that is not there in the android driver, which perhaps include breaking changes that perhaps break the android implementation.

The library only does the interaction with mogade, it knows nothing of the UI. I had plans to wrap each of the individual actions like getting ranks and such into AsyncTask's that would make your general UI usage easier, but I don't know if I ever got back to them and finished them. These tasks merely wrap the around interaction with the driver, so there isn't anything stopping you from doing that on your own.

I'll add some sample usage to the github wiki for android tonight, and then reply here with the info, but the pseudo code to do it is this:

1. Use MogadeConfiguration to override url / version (if necessary)
2. Create a DriverImpl (default implementation of Driver interface) with the gameKey and optionally secret (for operations that require secret)
3. Use the method for the info you want, it will return a Response<T> object
4. Check the response to see if it has an error, or use the data that was returned if it was successful.

Step 4 is synchronous, which is why I was going to make an AsyncTask implementation for each operation just so the developer using the library wouldn't need to, but it's pretty simple to put that into your own async task. Once you have the response, you would then interact with your UI to display the information.

If you are new to android, then what I said probably needs a bit more explanation. AsyncTask is a utility class in android that basically executes the code you provide on a thread and it does all the marshaling of the calls between background thread and UI thread for you (mostly). So for steps 1-4 you would put into the doInBackground method of the AsyncTask, and then store the result, then override the onPostExecute and use the result to update the UI. 

Here are some links to help you get started:  
Reply all
Reply to author
Forward
0 new messages