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

I’m trying to create a new android test project with CCGetsocial, I hadn’t done that for a while and i just can’t get through it at the moment, here is what I do:

  • I clone CCSocialNetwork in the extension directory of your cocos2d-x installation

  • go to cocos2d-x/tools/project-creator

  • create a new test project for CCSocialNetwork using the create_project.py

create_project.py project socialTestpackage com.cocos.socialTest ~~language cpp

~~ Start Eclipse and go to File\New\Other. Choose create Android\Android Project with existing code

  • select /Users/xxxx/cocos2d-x/extensions/CCSocialNetwork as root directory

now i’m in the situation where the test project is missing org.cocos2dx.lib.

so I try to get back to the CCGetsocial documentation and to do this:

  • Import cocos2d-x Library:
    3.1 File > Import > Android > Existing…
    3.2 Select $COCOS2d-2.1-rc0-x-2.1.2>cocos2dx/platform/android/java [A project named “java” will be see in workspace]
    3.3 Ok

but when i select /Users/xxxx/cocos2d-x/cocos2dx/platform/android, i can’t do next. there is a “-” sign on the project to import “java” line.

anyone has an idea of what i’m doing wrong ?

1º Are you sure you need create a new project with create_project.py? You cannot just import mine? Could you try skipping this step?
2º I edit NDK_ROOT too in build_native.sh :wink:
3º What message you get when you try to press next? If you a project already imported on a workplaces, you cannot import it again!

The IOS part is not using Facebook SDK.

It use #import <Social/Social.h>. It’s a little cheat.

All we can do is postFB and postTwitter.
We can’t get FB token or Session. This part is more useful.

Are you going to improve it?

Of course use Social, it is for iOS 6, must use it. We are not going to improve the code with token or session. It is not needed on iOS6, it take the device´s session of fFacebook and Twitter automatically.

Pipero Man wrote:

Of course use Social, it is for iOS 6, must use it. We are not going to improve the code with token or session. It is not needed on iOS6, it take the device´s session of fFacebook and Twitter automatically.

The postFB with Social framework in IOS 6 is post by self FB account not using own application and not authorize the application.

Atifiled Bruice wrote:

The postFB with Social framework in IOS 6 is post by self FB account not using own application and not authorize the application.

Yeap, it’s true. With this version, it’s impossible to post using the application’s account giving it the corresponding authorization.

Some time ago, we had a version of this sample project that was able to ask for the corresponding authorization and post directly through the application, but we had some annoying bugs that we couldn’t resolve. That’s why, we started over and developed this version and currently that function is not implemented. Now, we are finishing other aspects of our game that there are not related with this; but we wanted to post it to improve it with the help of the community. This is not a final version that is able to do all kind of social things, but it can be the starting point of something bigger.

I think that a lot of developers must have this problem resolved, but no one has published it :frowning:

Piperoman:

thanks, I could run it on my android device using your project (my mistake was I already had a cocosd-x project)

So now I see a “check internet” button, and it hangs when I click it :
_
04-08 12:32:08.828: I/DEBUG(29324): ** ** ** ** ** ** ** **
04-08 12:32:08.828: I/DEBUG(29324): Build fingerprint: ‘samsung/GT-S5360/GT-S5360:2.3.6/GINGERBREAD/XXKK6:user/release-keys’
04-08 12:32:08.828: I/DEBUG(29324): pid: 21236, tid: 21245 >>> org.example.SocialNetwork <<<
04-08 12:32:08.828: I/DEBUG(29324): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad
04-08 12:32:08.828: I/DEBUG(29324): r0 deadbaad r1 0000000c r2 00000027 r3 00000000
04-08 12:32:08.828: I/DEBUG(29324): r4 00000080 r5 afd46688 r6 0000a000 r7 46e36a10
04-08 12:32:08.828: I/DEBUG(29324): r8 46e36b48 r9 460daf34 10 460daf20 fp 46e36ed8
04-08 12:32:08.828: I/DEBUG(29324): ip ffffffff sp 46e36928 lr afd19405 pc afd15f7c cpsr 00000030
04-08 12:32:08.828: I/DEBUG(29324): d0 41a8000000000015 d1 40ad70007149f2ca
04-08 12:32:08.828: I/DEBUG(29324): d2 4d893b724250f5fc d3 00540ff04a2fa840
04-08 12:32:08.828: I/DEBUG(29324): d4 00000000002bea10 d5 3f8000003f800000
04-08 12:32:08.828: I/DEBUG(29324): d6 3f696b8927e8efc4 d7 7149f2ca3f000000
04-08 12:32:08.828: I/DEBUG(29324): d8 0000000000000000 d9 0000000000000000
04-08 12:32:08.828: I/DEBUG(29324): d10 0000000000000000 d11 0000000000000000

04-08 12:32:08.828: I/DEBUG(29324): d12 0000000000000000 d13 0000000000000000
04-08 12:32:08.828: I/DEBUG(29324): d14 0000000000000000 d15 0000000000000000
04-08 12:32:08.828: I/DEBUG(29324): scr 20000010
04-08 12:32:08.875: I/DEBUG(29324): #00 pc 00015f7c /system/lib/libc.so
04-08 12:32:08.875: I/DEBUG(29324): #01 pc 000138de /system/lib/libc.so
04-08 12:32:08.875: I/DEBUG(29324): code around pc:
04-08 12:32:08.875: I/DEBUG(29324): afd15f5c 68241c23 d1fb2c00 68dae027 d0042a00
04-08 12:32:08.875: I/DEBUG(29324): afd15f6c 20014d18 6028447d 48174790 24802227
04-08 12:32:08.875: I/DEBUG(29324): afd15f7c f7f57002 2106eb20 ec5cf7f6 0563aa01
04-08 12:32:08.875: I/DEBUG(29324): afd15f8c 60932100 91016051 1c112006 efe2f7f5
04-08 12:32:08.875: I/DEBUG(29324): afd15f9c 2200a905 f7f52002 f7f5efee 2106eb0c
04-08 12:32:08.875: I/DEBUG(29324): code around lr:
04-08 12:32:08.875: I/DEBUG(29324): afd193e4 447b4a0d 589cb083 90012600 686768a5
04-08 12:32:08.875: I/DEBUG(29324): afd193f4 220ce008 2b005eab 1c28d003 47889901
04-08 12:32:08.882: I/DEBUG(29324): afd19404 35544306 d5f43f01 2c006824 b003d1ee
04-08 12:32:08.882: I/DEBUG(29324): afd19414 bdf01c30 0002813a ffffff88 1c0fb5f0
04-08 12:32:08.882: I/DEBUG(29324): afd19424 1c3db087 a9044355 1c16ac01 604d9004
04-08 12:32:08.882: I/DEBUG(29324): stack:
04-08 12:32:08.882: I/DEBUG(29324): 46e368e8 00000015
04-08 12:32:08.882: I/DEBUG(29324): 46e368ec afd18497 /system/lib/libc.so
04-08 12:32:08.882: I/DEBUG(29324): 46e368f0 afd42624
04-08 12:32:08.882: I/DEBUG(29324): 46e368f4 afd467a4
04-08 12:32:08.882: I/DEBUG(29324): 46e368f8 00000000
04-08 12:32:08.882: I/DEBUG(29324): 46e368fc afd19405 /system/lib/libc.so
04-08 12:32:08.882: I/DEBUG(29324): 46e36900 80d38ae1 /data/data/org.example.SocialNetwork/lib/libcocos2dcpp.so
04-08 12:32:08.890: I/DEBUG(29324): 46e36904 afd18469 /system/lib/libc.so
04-08 12:32:08.890: I/DEBUG(29324): 46e36908 0000001b
04-08 12:32:08.890: I/DEBUG(29324): 46e3690c 00000000
04-08 12:32:08.890: I/DEBUG(29324): 46e36910 afd46688
04-08 12:32:08.890: I/DEBUG(29324): 46e36914 0000a000
04-08 12:32:08.890: I/DEBUG(29324): 46e36918 46e36a10
04-08 12:32:08.890: I/DEBUG(29324): 46e3691c afd18707 /system/lib/libc.so
04-08 12:32:08.890: I/DEBUG(29324): 46e36920 df002777
04-08 12:32:08.890: I/DEBUG(29324): 46e36924 e3a070ad
04-08 12:32:08.890: I/DEBUG(29324): #00 46e36928 4051eb50
04-08 12:32:08.890: I/DEBUG(29324): 46e3692c 000eed78
04-08 12:32:08.890: I/DEBUG(29324): 46e36930 afd46628
04-08 12:32:08.898: I/DEBUG(29324): 46e36934 afd11064 /system/lib/libc.so
04-08 12:32:08.898: I/DEBUG(29324): 46e36938 001ebf68
04-08 12:32:08.898: I/DEBUG(29324): 46e3693c fffffbdf
04-08 12:32:08.898: I/DEBUG(29324): 46e36940 000000da
04-08 12:32:08.898: I/DEBUG(29324): 46e36944 afd46470
04-08 12:32:08.898: I/DEBUG(29324): 46e36948 000001b4
04-08 12:32:08.898: I/DEBUG(29324): 46e3694c afd138e3 /system/lib/libc.so
04-08 12:32:08.898: I/DEBUG(29324): #01 46e36950 afd46470
04-08 12:32:08.898: I/DEBUG(29324): 46e36954 afd138e3 /system/lib/libc.so
04-08 12:32:08.898: I/DEBUG(29324): 46e36958 00000000
04-08 12:32:08.898: I/DEBUG(29324): 46e3695c 001d8f98
04-08 12:32:08.898: I/DEBUG(29324): 46e36960 000000bd
04-08 12:32:08.898: I/DEBUG(29324): 46e36964 0000001b
04-08 12:32:08.898: I/DEBUG(29324): 46e36968 433d0000
04-08 12:32:08.898: I/DEBUG(29324): 46e3696c 000eed78
04-08 12:32:08.898: I/DEBUG(29324): 46e36970 000eed78
04-08 12:32:08.898: I/DEBUG(29324): 46e36974 00000013
04-08 12:32:08.898: I/DEBUG(29324): 46e36978 46e36a10
04-08 12:32:08.898: I/DEBUG(29324): 46e3697c afd147f5 /system/lib/libc.so
04-08 12:32:08.898: I/DEBUG(29324): 46e36980 000eed78
04-08 12:32:08.898: I/DEBUG(29324): 46e36984 80d28269 /data/data/org.example.SocialNetwork/lib/libcocos2dcpp.so
04-08 12:32:08.898: I/DEBUG(29324): 46e36988 000eed78
04-08 12:32:08.898: I/DEBUG(29324): 46e3698c 80d28285 /data/data/org.example.SocialNetwork/lib/libcocos2dcpp.so
04-08 12:32:08.898: I/DEBUG(29324): 46e36990 000eed78
04-08 12:32:08.898: I/DEBUG(29324): 46e36994 80d07315 /data/data/org.example.SocialNetwork/lib/libcocos2dcpp.so
04-08 12:32:09.460: I/DEBUG(29324): dumpstate /data/log/dumpstate_app_native.txt_

maybe would cool cool to have all the others features linked as well.

Dear Pipero,
Let me ask you one question…all this for just to post the scores to Facebook/Twitter/Google+ etc?.
I have implemented this features(to post Quotes to Social networks) in some of my apps( https://play.google.com/store/apps/developer?id=zuHa )
Can you please go through facebook post features in any of these apps? if you need the same feature i can give u the code… its nothing but just pass score as arguments through the FB/Twitter urls…

`franck: Android is not working right now. If someone help me with the problem calling IsInternetConnection, I will continue with Android integration. I have not enought free time to continue thinking what is going on this month.

`Real Zapster: Thanks for you offer. I have tested 2 of your Apps but is not I looking for. You app open browser and it have interaction with your Facebook App. I prefer to use Facebook directly using the SDK. My problem is about JNI calls.

what is wrong with the internet connection ?

on my device it opens a screen with “check internet” button,

then i get this in the logs:

04-10 17:15:31.648: D/cocos2d-x debug info(5307): cocos2d: GL_VENDOR: Broadcom
04-10 17:15:31.648: D/cocos2d-x debug info(5307): cocos2d: GL_RENDERER: VideoCore IV HW
04-10 17:15:31.648: D/cocos2d-x debug info(5307): cocos2d: GL_VERSION: OpenGL ES 2.0
04-10 17:15:31.648: D/cocos2d-x debug info(5307): cocos2d: GL_MAX_TEXTURE_SIZE: 2048
04-10 17:15:31.648: D/cocos2d-x debug info(5307): cocos2d: GL_MAX_TEXTURE_UNITS: 8
04-10 17:15:31.648: D/cocos2d-x debug info(5307): cocos2d: GL supports PVRTC: NO
04-10 17:15:31.648: D/cocos2d-x debug info(5307): cocos2d: GL supports BGRA8888 textures: NO
04-10 17:15:31.648: D/cocos2d-x debug info(5307): cocos2d: GL supports NPOT textures: YES
04-10 17:15:31.648: D/cocos2d-x debug info(5307): cocos2d: GL supports discard_framebuffer: YES
04-10 17:15:31.648: D/cocos2d-x debug info(5307): cocos2d: GL supports shareable VAO: NO
04-10 17:15:31.656: D/cocos2d-x debug info(5307): cocos2d: compiled with Profiling Support: NO
04-10 17:15:31.671: D/cocos2d-x debug info(5307): Static helloWorld
04-10 17:15:31.671: D/cocos2d-x debug info(5307): helloWorld Status: 0
04-10 17:15:31.671: V/InternetConnection(5307): HELLO WORLD
04-10 17:15:31.671: D/cocos2d-x debug info(5307): helloWorld Done
04-10 17:15:31.718: D/dalvikvm(5307): GC_EXTERNAL_ALLOC freed 179K, 48% free 2810K/5379K, external 516K/517K, paused 39ms
04-10 17:15:31.726: D/cocos2d-x debug info(5307): Go to check Internet connection…
04-10 17:15:31.726: D/cocos2d-x debug info(5307): HelloWorld: tryIsInternetConnection
04-10 17:15:31.734: D/cocos2d-x debug info(5307): InterfaceJNI isInternetConnected
04-10 17:15:31.734: D/cocos2d-x debug info(5307): isInternetConnected Status: 0
04-10 17:15:31.734: D/cocos2d-x debug info(5307): isInternetConnected Finding Class….
04-10 17:15:31.734: D/cocos2d-x debug info(5307): isInternetConnected Getting method….
04-10 17:15:31.734: D/cocos2d-x debug info(5307): isInternetConnected Calling method….
04-10 17:15:31.734: V/InternetConnection(5307): isInternetConnection Start
04-10 17:15:31.734: D/cocos2d-x debug info(5307): Call done
04-10 17:15:31.734: D/cocos2d-x debug info(5307): isInternetConnected Done, value is: 1

then the application exits.

It´s a problem with the JNI call. I don´t know why, when I use the Static call which return a boolean, I get a SIGBUS exception. I have no time now to look for the problem, I will do it in the future.

Otherwise, maybe http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Plugin-X will get opensource this month, and I could use some examples to fix CCSN

you get a SIGBUS when you call _static bool isInternetConnected()_ ?

it s strange I don’t have it anymore I changed nothing.

Yes, I get the correct return value, true if is correct, or false if the tablet is in flymode, but then the app crash with a SIGBUS exception, or Signal 11 if I change some lines.

On a samsung y in flight mode, I don’t get a crash.
but I still get a “isInternetConnected Done, value is: 1”

@franck: Check the return value from java, maybe is always true.

I have discover: http://192.9.162.55/docs/books/jni/

If someone want to learn more about JNI. I hope have time to read it and solve the problems next week.

Yes it’s always returning true.

Wish I could help on that, but i’m quite clueless about java and android (donno if it’s because my old Samsung Y or because of the crappy Eclipse enviroment, but it takes me ages to run a simple test. :frowning: )

there is this tutorial, with a very nice java package, for android + twitter:

I went quite far using it, but i couldn’t make it work correctly inside cocos2d-x.

it looks like this guy is making a social networking plugin for cocos2dx, I have also seen some posts from him here on this forum

twitter: @ezibyte
web: http://www.ezibyte.com

PS: According to his twitter account, the plugin might be released this weekend

The code has been released!

Basic use is free, fine!

But…

EziSocial for Cocos2D-X: Basic version is free to use.
Advance version: Individual Game Licence: $2.99
Corporate Licence: $14.99

I think is enought for me, but some people which want manage FB API must pay.

If someone need advanced manage, I will release some code some day, but CCSocialNetwork is not my preference now…. so, don´t wait for me.


CCSocialNetwork:

Now in Android work isInternetConnection, send an email, and send a basic tweet (without use a library, the message can be edited by the user :frowning: )

_Now in Android work isInternetConnection, send an email, and send a basic tweet (without use a library, the message can be edited by the user :frowning: )_

What are you talking about ? your lib or ezibyte’s ?

I´m talking about my library