Sample Project to use Facebook, twitter, and send e-mails using cocos2d-x

Hi Pipero,

I will try to resolve the issue as soon as possible and will share the solution but i need a favour from you, can you please make a small n good tutorial on how to use JNI in an android project?
I need steps so that i can easily understand that .

I really appreciate your help.

Pipero Man wrote:

I don ´t know whats is happening.
It throw an exception OpenGL using FB.
>
What is your android version??? I was using Android 3.0, with 2.2 minimun and cocos2d-x 2.0.1
>
Try to post it on www.stackoverflow.com. If you get a answer, please post it here!

I am using Android version 4.1 ,with minimum 2.2 and cocos2dx-2.0.2

Pipero Man wrote:

I don ´t know whats is happening.
It throw an exception OpenGL using FB.
>
What is your android version??? I was using Android 3.0, with 2.2 minimun and cocos2d-x 2.0.1
>
Try to post it on www.stackoverflow.com. If you get a answer, please post it here!

Hi Pipero,
I got a fix for your problem .

In you GetSocial.java,Add
static Context mContext;

then onCreate function do this:-
mContext = GetSocial.this;

then inside your postMessage method do this inside of just facebookConnector.login();
((Activity)mContext).runOnUiThread(new Runnable(){
@Override
public void run() {
facebookConnector.login();
}

});

The problem was
you were trying to run it on different thread but it should on the main thread.

Hope this will help you out.

Saurabh Mudgal wrote:

I am using Android version 4.1 ,with minimum 2.2 and cocos2dx-2.0.2
>
Pipero Man wrote:
> I don ´t know whats is happening.
> It throw an exception OpenGL using FB.
>
> What is your android version??? I was using Android 3.0, with 2.2 minimun and cocos2d-x 2.0.1
>
> Try to post it on www.stackoverflow.com. If you get a answer, please post it here!

plz help me ;( I got the problem of adding Facebook library.

facebook sdk 3.0b was opened of FacebookActivity

But InApp-Purchase in Korean telecommunications need to inheritance at activity

and I cant multiful Inheritance is in java…

how can I resolve this problem…

My sample project include all you need to do it work. I used an older version of facebook sdk. I´m working to update this project…. but now i don ´t know how do it. Here you are a simple guide to integrate new sdk : https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/
I don´t understand what is your problem. I had never used In app purchase.

@piper man
Your sample project dont have info.plist and other Api’s cocos2d-x etc…Your project is not running from me.please update it by including these things…

We are working in a new version for iOS6, Facebook framework 3 for android, and other things. But we have not time right now, I hope finish it soon.

cocos2dx for WP can use : http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj206982(v=vs.105).aspx

@surhab

I m using Pipero’s code but the same error is occurring :

01-23 13:05:36.160: E/AndroidRuntime(15740): FATAL EXCEPTION: GLThread 10
01-23 13:05:36.160: E/AndroidRuntime(15740): java.lang.ExceptionInInitializerError
01-23 13:05:36.160: E/AndroidRuntime(15740): at org.cocos2dx.lib.Cocos2dxRenderer.nativeTouchesEnd(Native Method)
01-23 13:05:36.160: E/AndroidRuntime(15740): at org.cocos2dx.lib.Cocos2dxRenderer.handleActionUp(Cocos2dxRenderer.java:120)
01-23 13:05:36.160: E/AndroidRuntime(15740): at org.cocos2dx.lib.Cocos2dxGLSurfaceView$8.run(Cocos2dxGLSurfaceView.java:245)
01-23 13:05:36.160: E/AndroidRuntime(15740): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1346)
01-23 13:05:36.160: E/AndroidRuntime(15740): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1138)
01-23 13:05:36.160: E/AndroidRuntime(15740): Caused by: java.lang.RuntimeException: Can’t create handler inside thread that has not called Looper.prepare()
01-23 13:05:36.160: E/AndroidRuntime(15740): at android.os.Handler.(Handler.java:121)
01-23 13:05:36.160: E/AndroidRuntime(15740): at org.mons.project.GetSocial.(GetSocial.java:36)
01-23 13:05:36.160: E/AndroidRuntime(15740): … 5 more

I tried your solution but still that error is occurring…do you have any other solution?

I´m sure the is a Thread problem from Java. All stackoverflow answer say the same, like this:

use function runOnUiThread() on Java file, to make the call and it will work.

I already tried it but the same error is occurring…

and your class GetSocial also giving me error on super.setpackage(name)…help me

Tried to get the code to work but have given up. I think at this stage both the facebook SDK and Cocos2dx are out of date.

I do not want to implement the social integration myself but it looks like I’m going to have to…sigh…I suppose it will give me a better understanding of the framework and allow me to make more native extensions in the future.

I Will post a Social updated code soon. If someone want to colaborate creating an extension please contact to me.

I think I would be more of a hindrance than a help TBH, I’m not familiar enough with this framework and C++/Java hybrid projects yet…yet!

@Pipero man please update it soon :slight_smile:

any update soon ? :slight_smile:

I ’m so sorry, but i had no time for the moment. An update isn’t complicated, it just need some hours testing the APIS. Its only update with iOS 6 frameworks, update to New API FACEBOOK in ANDROID, and try to integrate GREE following: http://labs.gree.jp/blog/2012/12/6846/

I hope have time whis week, or this month in worst case.

thanks for the link to gree,
I coded a twitter reverse auth in iOS in order to identify twitter users on an highscore server.
any idea what is the best way to do this on android ?
http://twitter4j.org/en/index.html ?

In this link,https://github.com/Piperoman/CCSocialNetwork/tree/master/Classes
i can’t find ObjCalls class, so where i can find this class:(