Sex Invaders completed! For Android 2.2 or higher, w/ Facebook highscores!

Hey everyone,

My first game for Android made with Corona. Sex Invaders, available in the Android Marketplace.

Sorry, no iPhone version. Apple won't allow it.

I was able to create a highscore server and facebook integration too. Let me know if this is interesting to anyone else as I may make the service publicly available if people are interested.

No link? No worries, I'm at work so I couldn't click on it anyway :(

Can you post your facebook posting method using the android side? There are known issues with it using Corona / Android and myself among others would love to know how you are using the facebook posting over an Android device.

I didn't use the facebook.lua module. instead I just created a web popup and directed it to my own server. All the facebook handling is done through the server and OAuth.

You were ahead of me but I'm not far behind! I think this is the best way to use facebook on Android. I've already built my processing page and it was actually easier than using the Corona api for facebook connect (though it is native and would be a bit more seamless)!
Thanks for the tip.

Say, what trick did you use inside the webpopup to get the OAuth to work? I'm able to pass parameters all the way back to the processing webpage on my webserver but the post doesn't ever "popup" like it does in a webbrowser(tested in browser and the post works)..

no tricks, i just connect to my server. the server then redirects to facebook and does the oauth there between the two servers.

I understand. That's exactly what I'm trying to do but still no luck. I just get a white screen on the Android device when posting. Would you care to share your web code that posts to Facebook from your web server?

Hope you like Python ;)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
class LoginHandler(BaseHandler):
    def get(self):
        args = dict(client_id=FACEBOOK_APP_ID, 
                    redirect_uri=self.request.path_url, 
                    scope="publish_stream", # extended permissions so that the game can publish to the users stream
                    display="touch")
        
        verification_code = self.request.get("code") # fyi, this code is also the facebook session id
        if not verification_code:
            logging.info("redirecting to facebook for authorization")
            self.redirect("https://graph.facebook.com/oauth/authorize?" + urllib.urlencode(args))
            return
            
        args["client_secret"] = FACEBOOK_APP_SECRET
        args["code"] = verification_code
 
        page = urllib.urlopen("https://graph.facebook.com/oauth/access_token?" + urllib.urlencode(args)).read()
        result = cgi.parse_qs(page)
        
        if "access_token" not in result:
            self.response.out.write("access token not recieved from facebook")
            logging.error(page)
            if "error_reason" in result:
                self.response.out.write(result["error_reason"])
                logging.error(result["error_reason"])
            return
 
        logging.info("access_token recieved")
        access_token = result["access_token"][-1]
 
        profile = json.load(urllib.urlopen("https://graph.facebook.com/me?" + urllib.urlencode(dict(access_token=access_token))))
 
        set_cookie(self.response, "fb_user", str(profile["id"]), expires=time.time() + 30 * 86400)
        self.redirect("/")

Got it, works perfect!
Thanks for your assistance -

Still no link? I'm not at work now ;)

I shudder at the prospect of googling Sex Invaders, so I think I'll wait for a link from you to check out the game.

Hi ORBZ, I am trying to implement something similar to yours but getting back a JSON file to the app. I was wondering if you had any advice that I could use. I am using this

http://ideveloper.kodingen.com/2010/facebook-friends-leaderboard/

Everything is setup and works I modified the PHP to get the JSON file sent, but I am having a hard time reading it into a table. I am a complete beginner at both PHP and any sort of communication protocol.

Any tip would be appreciated. Thanks

Could we get a tutorial on how to implement this on the server and the app side? That would be awesome!

I tested your game and high score system is very good and i would like to include it to my game. So ORBZ, could you share your code or teach me how to make it? I am quite new in coding, so i dont understand fully how to do that. And could your facebook friends high score system change someway to global facebook users high score system? Please help me. :)

come on make it published, I'll be the one of many people interested in your application.
vimax

Looks like a funny game :) but don't have an Android phone :(
Congrats!

views:1784 update:2011/9/23 8:53:55
corona forums © 2003-2011