Facebook login in J2ME device

108 views
Skip to first unread message

Vitaliy Paromskiy

unread,
Apr 4, 2014, 3:48:09 AM4/4/14
to codenameone...@googlegroups.com

Hello,
I created demo application in which user can login in Facebook. I use FaceBookAccess code from Facebook Demo. And it is working on real Android devices, but it doesn't on real J2ME devices.
When login button is pressed, empty white login form is displayed. Actual fields for login are not displayed. User can return to prev form using back button.
User also can wait more then 5 minutes but Login form is never rendered. Sometimes an OutOfMemory exception is thrown during waiting for form rendering.
Same behaviour (except of OutOfMemory exception) when test application in NetBeans simulator (iphone, nexus and feature phone).

Please help me to solve this problem.

Tested on J2ME devices:
1. Nokia C1-01
2. Nokia Asha 302

Shai Almog

unread,
Apr 4, 2014, 2:59:37 PM4/4/14
to codenameone...@googlegroups.com
Hi,
does the FacebookDemo from our docs and demos zip work for you?
If so just use that as a model for how to login.

Vitaliy Paromskiy

unread,
Apr 7, 2014, 5:48:30 AM4/7/14
to codenameone...@googlegroups.com
The problem is strange. When I create a new project and add FecabookDemo code, everything is working properly (simulator opens FB login page).
But if I add FecabookDemo code to my project -> browser login page is blank. As I understand the difference is only in configuration file codenameone_settings.properties but.
My project was created 5 months ago, and I always update CN1 plugin for NetBeans. Maybe during plugin update project configuration was not updated properly?

What can be the reason why FBDemo code work in new project but doesn't work in my project that was created few month ago?
codenameone_settings.properties

Shai Almog

unread,
Apr 7, 2014, 1:07:26 PM4/7/14
to codenameone...@googlegroups.com
The properties aren't updated as part of that process. I'm guessing that something else got broken when you tried to replicate the code to create the login process. Did you run this in the debugger for both the facebook demo and your code?

Vitaliy Paromskiy

unread,
Apr 8, 2014, 11:28:49 AM4/8/14
to codenameone...@googlegroups.com
During debug I found that when WebBrowser try to load page for rendering FB login, Web browser onError() method is triggered.
Message -> SSL handshake failed
Error Code -> -1

URL is something like this:
https://www.facebook.com/dialog/oauth?client_id=11111111111111&redirect_uri=http%3A%2F%2Fsome.com%2F&scope=&response_type=code&display=popup

Shai Almog

unread,
Apr 8, 2014, 2:53:05 PM4/8/14
to codenameone...@googlegroups.com
You have a right client id set and not just 111111111 right?

Vitaliy Paromskiy

unread,
Apr 9, 2014, 1:26:11 AM4/9/14
to codenameone...@googlegroups.com
Sure.

вторник, 8 апреля 2014 г., 21:53:05 UTC+3 пользователь Shai Almog написал:

Shai Almog

unread,
Apr 9, 2014, 1:35:06 AM4/9/14
to codenameone...@googlegroups.com
Maybe Chen has an idea

Chen Fishbein

unread,
Apr 9, 2014, 3:42:17 AM4/9/14
to codenameone...@googlegroups.com
That's a strange issue:
1)Did you deleted all storage under your .cn1 directory before trying yours? (in the new simulator there is a button for this "Simulate->Clean Storage")
2)Did you defined your own facebook app or are you using ours from the demo? you can follow this tutorial and let us know if that helps - http://developer.nokia.com/community/wiki/How_to_connect_to_Facebook_using_CodenameOne_on_Series_40


Vitaliy Paromskiy

unread,
Apr 9, 2014, 5:42:54 AM4/9/14
to codenameone...@googlegroups.com
I found, it was my problem.
"SSL handshake failed" message was displayed when request send request to any https site that use ssl v3.
For my project, in Run configuration, i add those args -Djavax.net.ssl.trustStorePassword=changeit -Djavax.net.ssl.trustStore=.keystor;
That's was the reason.

Thanks for your help.
*I use latest plugin 1.0.71 but my Simulator doesn't have 'clean storage' button.
Reply all
Reply to author
Forward
0 new messages