2017年1月16日 星期一

LiveCode Android External: Integrate Facebook and Google Login

I've used LiveCode for more than five years. As a Android developer using LIveCode, it always feel like there is less support for Android than iOS. Thanks to Monte, we have lots of iOS externals to use in LiveCode Indy. It will be great if we have all these externals in Android version. I have some experience about building Android external. So I decided to do it myself. I think it will definitely enhance people's intention to use LiveCode. Hope someday my external will be integrated into LiveCode Indy just like Monte did.

Start with Facebook and Google login function.

[Facebook]
First we need to initialize Facebook SDK.
on mouseUp                                           
     put haoFacebookInit("{APP_ID}")
end mouseUp                                        


















Then open Facebook login view and pass the permissions you wish.
put haoFacebookLogin("email"&cr&"public_profile") into tResult





















After successfully login we can get the access token. With access token, we are able to use the Graph API. Graph API can do a lot of things such as getting user name, id, photos even post photos almost anything.

put haoFacebookGetAccessToken() into tToken
GET URL ("https://graph.facebook.com/me?access_token="&tToken)

answer the urlResponse






















[Google]
It's much easier to login to Google using LiveCode External. Just one command.























put haoGoogleAuthLogin() into tResult 

This command open Google login view.






















When successfully login. Account information will return to LiveCode. 























These two simple login function take me several days. It's a good start and I will try to build more and make them more stable.

1 則留言:

  1. Hi, HAO do you sell it ?

    I would like to know if you could help me with a firebase external development?

    best regard
    Jose

    回覆刪除