WebViewTwitter

This example application is a simple Twitter client that shows tweets by selected users. Users can be added to a Favorites List stored on the device. The app uses the jQuery JavaScript library and its jQtouch plug-in, and the MoSync Wormhole C++ Library.

  
 Tweet Reader screen (Android) User tweets screen (Android)

This example is included in the MoSync SDK installation in the /examples folder. For information on importing the examples into your workspace, see Importing the Examples.

Behavior

When started, this example application displays the main application screen headed "Tweet Reader". On this screen the user can enter the username of a Twitter user. On tapping View Tweets by this user, a second screen is displayed showing that Twitter user's recent tweets.

On the main application screen the user can also add the Twitter user's username to a Favourites List, or tap on an entry in the Favourites List to go straight to that person's tweets.

In the Code

The following technologies are used in this application:

  • HTML5, Javascript, and jQtouch for the design the main user-interface elements and handling of UI events.
  • The JQuery getJSON function to call the Twitter API and parse the JSON document that is returned as a result.
  • The MoSync Wormhole Library is used for bi-directional communication between MoSync C++ code and JavaScript.
  • MoSync File API (C++) to write to and read from the device's file system.

Included in the example is a set of wrapper functions for accessing the MoSync File API from Javascript.

WebViewTwitter.cpp is the main file. It includes an implementation of WebAppMoblet. The example application uses class MessageStreamJSON to process and respond to messages coming from JavaScript.

Note that this example doesn't make use of the full wormhole.js library, it uses a subset of that library, the file mosync-bridge.js, which is used to send messages between JavaScript and C++. For an example that uses the full Wormhole JavaScript library, check out the WormholeDemo program.

All of the HTML5 and JavaScript-related files and libraries are located in the LocalFiles directory, and bundled with the application and extracted to the local file system of teh device the first time the application launches

The Resources.lst file has a default entry for the bundled files that should not be removed unless you want to remove all of the HTML5 functionality.



Getting the code

I installed SDK2.6 and can't find the source of this project in the example folder. Do I need to download the latest nightly build to get it?

Re: Getting the Code

Hi emak,
sorry for the delay, The app is included in the 2.7 Release as an example. So if you download 2.7 you will have access to it. Additionally you can always download all of our example programs (even the ones that are not delivered with the package) from our Github Repository. Just click on The code item in the menu above.

app crash

Greetings,

The application has crashed on the Android Emulator and device with Android OS but on the WP7 Emuator is working fine.
How can I make debugging HTML5/C++ application in the MoSync for example for C++ parts?

Thanks

What version of Android

What version of Android Emulator (API level) are you using? There is a problem in the Android Emulator API level 8 which causes the crash if you use a newer version or a phone it will work. You can use adb logcat to see the poblem.

I used API level 7 and 8 when

I used API level 7 and 8 when application has crashed.
I have executed WebViewTwitter app on the Android Emulator API level 10 without any troubles.