| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Using Facebook Connect on Mobile (J2ME) (redirected from Using-Facebook-Connect-on-Mobile-(J2ME)

Page history last edited by Niek van Suchtelen 13 years, 9 months ago

Facebook Connect through J2ME

 

In order to address the huge mobile phone market and to use the Graph API through J2ME, it's vital that Facebook Connect can be integrated into a J2ME (Java ME) application. SDK's already exist for both iPhone and Android, but unfortunately not for the much larger J2ME platform. 

 

Challenges of Facebook Connect on J2ME

 

Facebook Connect is designed around an HTML page flow (for the user to log in and accept the permissions). This works well for all platforms that can render HTML, including all desktop platforms and smartphones such as the iPhone and Android.

 

Unfortunately, J2ME doesn’t offer a way to render HTML. There’s no such thing as a “WebView” or similar component in J2ME. Instead, the phone’s default browser could be used for this, which would work in theory. In practice however, this will cause many issues: on many phones for instance, the browser won’t open until the app is closed. Also, after finishing the session in the browser, the user has to get back to the app. There is no standard way of doing this, and this process would inevitably lead to many frustrated users ending up on the homescreen of their phone, not knowing what to do next. 

 

Clearly, this is far from a Great User Experience, one of the main objectives listed in Facebook's Developer Principles and Policies.

 

Proposed solution overview

 

The ideal solution would revolve around three important parts:

 

 

  • The complete Facebook Connect flow is handled from inside the J2ME application, for the best, most reliable user experience.
  • Facebook Connect is used as it currently exists, so the solution can be applied immediately: i.e., no changes are required by Facebook.
  • The user's privacy is guaranteed, so only Facebook gets access to the user's ID and password; i.e., the data flow is the same as when using a browser, using the same protocols (including an HTTPS from the client to Facebook).

 

How would this work, technically?

 

The above overview may sound ambitious, given the limitations of J2ME. However, a solution is proposed that works according the the following steps:

 

 

  1. The J2ME app makes an HTTP connection to Facebook and downloads the login page HTML.
  2. This HTML is converted to an XML representation that can be rendered by the J2ME app, and that contains the necessary form parameters, action URL, etc.
  3. The user fills in the form, and submits it directly to Facebook through HTTPS, which returns the permissions page HTML.
  4. Back to step 2 to convert the permissions page.

 

 

As can be seen, the main part necessary to make this work is the HTML -> XML converter. A simple XML format is designed that can be easily parsed by the app and transformed into J2ME UI components. This format should include the main components of an HTML form, including an input field, submit button, text, image, action URL. But not much more.

 

As Facebook may from time to time update their Facebook Connect HTML design, it's vital that the converter not only works today, but also in the future. Therefore, unless a perfectly generic HTML->XML transcoder can be written, it's not a good idea to put this converter on the client, because these clients aren't regularly updated by the users. So, the converter part should reside on a server to be maintained by the app developer, and to be accessed by the J2ME app. That way, if Facebook changes the page design and the converter would break, it can quickly be updated on the server to make it work again, with only minimal downtime.

 

To make it more clear: step 2 above sends the HTML content to a server, which transforms it and sends it back to the client to be rendered. Note that no user credentials are shared with the server - these are only shared with Facebook in step 3.

 

That's it! What we need is people to contribute additional ideas, and some input from Facebook to ensure that they are also happy with this idea, so that a lot of J2ME developers can finally commit to making reliable Facebook enabled apps.

 

 

 

 

Comments (0)

You don't have permission to comment on this page.