Tuesday, January 18, 2011

Mosync - Mobile Development

What is MoSync?
MoSync is a mobile application development SDK based on common programming practices and standards - like full Eclipse integration and C/C++. MoSync's fully-featured software development kit helps you develop anything from simple programs for basic mobile phones to advanced applications that exploit the full potential of the latest intelligent smart phones and mobile devices.

Fully-Featured SDK

  • Eclipse-based IDE for C/C++ application development
  • Windows and OS X development environments
  • Runtime emulation and debugging
  • Comprehensive mobile device database, with regular updates
  • Application transfer by bluetooth/USB
  • Mobile development tools and utilities
  • Extensive documentation
  • Active, dedicated worldwide development community.

Comprehensive Libraries

  • Selected standard C libraries
  • Graphics, audio, multimedia
  • TCP/HTTP/Bluetooth/SMS
  • Collection classes
  • XML parsing
  • UI library and font framework
  • Map rendering library

Extensive Mobile Platform Support

  • iOS (iPhone, iPad, iPod Touch) 3.x
  • Android Cupcake 1.5, 1.6, 2.1
  • Java ME MIDP 2 (J2ME)
  • Moblin 2.x
  • Pocket PC 2003
  • Smartphone 2003
  • Symbian S60 2nd, 3rd, and 5th ed
  • Windows Mobile 5.0-6.5

Platform-Dependent Features

Feature/Platform
MoRE (MoSync emulator)
Java ME
Windows Mobile
Symbian S60 2nd, 3rd, 5th
Android 1.5, 1,6, 2.1
iOS 3.x (iPhone, iPad, iPod Touch)
Moblin/
MeeGo
Basic graphics
Basic audio
Permanent storage
Numeric keypad input
n/a
n/a
Native text box input
Qwerty keypad input
n/a
Stylus/touch input
2nd/3rd:
5th:
Socket communication
HTTP communication
SSL Socket communication
HTTPS communication
Bluetooth discovery
1.5/1.6:
2.1:
Bluetooth communication
1.5/1.6:
2.1:
Bluetooth server
1.5/1.6:
2.1:
Location
3rd/5th:
PIM
2nd:
3rd/5th:
File system access
Camera access
Locale (639-1 or 639-2)
Win32:
IMSI/IMEI
Sending SMS
Dynamic program loading
Framebuffer drawing
Vibration
Audiobuffer
Sound codecs (some devices may have more codecs preinstalled)
Wav, MP3, AMR
Wav, MP3, AMR
Wav
Wav, MP3, AMR
AAC, AMR, Wav, MP3, OGG, MIDI
AAC, AIFF, MP3, Audible, Apple Lossless, WAV
Wav, MP3, AMR


Platform-Independent Features

Feature

Eclipse-based IDE
Advanced device emulator
Resource management
Device profiles database
Extensive documentation
Fully integrated debugger
Selected standard C libraries
Custom UI (MAUI)
OOP TCP Communications
OOP HTTP Communications
SOAP Communications
JSON/REST layers
Twitter API
Collection library
XML parsing libraries
Font libraries/converters
Map rendering API
On-device error reporting
Batch building (finalizer)

Installing the MoSync SDK for Windows

 

Downloading MoSync

last featured release of the MoSync SDK for Windows from the Download page at our website: http://www.mosync.com/download.

Important note: The MoSync SDK for Windows enables you to directly build application packages for Java ME, Symbian, Android, Windows Mobile, Smartphone, Pocket PC, and Moblin/Meego devices.

System Requirements

MoSync is designed to run on any PC that meets the following requirements:
  • Microsoft Windows XP, Vista or Windows 7 operating system
  • Java SE Runtime Environment (JRE) 6
  • 300MB free hard drive space

Install or update your Java SE Runtime Environment before installing MoSync.
To use MoSync's device discovery and transfer features, you will also need a Bluetooth-enabled PC, a mobile device and one of the following software stacks:



  • Microsoft (included in Windows XP Service Pack 2)
  • WIDCOMM (aka Broadcom)
  • BlueSoleil
To use the emulator's Bluetooth support when testing programs, you will need the Microsoft stack.


 

Running the Installer


After you have downloaded the MoSync installer package, double-click the file to begin the installation. The installer will unpack the files and begin the installation process.


 When the files have been unpacked, the MoSync splash-screen will appear


The splach screen will fade and our license agreement will appear. Please take the time to read the MoSync License Agreement — it contains important information about the terms under which we supply the MoSync SDK. Agree to it if you would like to proceed with the installation.

Select the components you wish to install. Note that there isn't any options for the MoSync package, everything needs to be installed.



Select where you would like MoSync to be installed. Please note that MoSync needs to be installed to a directory which is not containing any spaces in its path.

 








If you had a previous installation it will first be removed before the new version of the MoSync SDK is installed on your computer. Please wait for the installation to complete. The installation process may take a few minutes.









As part of the installation process, the Microsoft Visual C++ 2005 Redistributable will also be installed and some changes will be made to environment variables.

MoSync is now installed. Press Finish to end the installer and open the MoSync IDE





Creating Your First Application

Start by Launching MoSync. When MoSync prompts you to select a workspace, accept the default path. The MoSync IDE will open. Close the Welcome page if it is showing.
Create a new project by right-clicking in the Project Explorer view then choosing New > Project.
Note: If you have hidden the Project Explorer view, you can show it again by selecting Window > Show View > Other > General > Project Explorer and then clicking OK.)





When the New Project window opens, expand the MoSync folder






In the folder MoSync you will find wizards for creating MoSync projects.
Select the one called MoSync Project.
Click Next.
The project name and location screen appears






Enter the Project name "HelloWorld". Tick the Use default location box. Click Next.
A new window will open showing you the templates that are available for you new project




 
For more information about these templates, see Creating Projects from Templates


Select the MoSync Moblet Project template. Select it and click Finish.

Your new project will now be created from the template and loaded in the MoSync IDE:


Creating HelloWorld

Edit the code in the main.cpp file shown in the main window so that it looks like this:
#include <MAUtil/Moblet.h>

using namespace MAUtil;

class MyMoblet : public Moblet {
public:

    MyMoblet() {
        maSetColor(0xFFFFFF);

        maDrawText(0, 32, "Hello World!");
        maUpdateScreen();

    }
    void keyPressEvent(int keyCode, int nativeCode) {

        if(keyCode == MAK_0)
        {

            close(); 
         }

    }
    void keyReleaseEvent(int keyCode, int nativeCode) {

        // todo: handle key releases
    }

};
extern "C" int MAMain() {

    Moblet::run(new MyMoblet());
    return 0;

};

Understanding Moblets

In the constructor of the MyMoblet class, we have added these lines:
maSetColor(0xFFFFFF); 
maDrawText(0, 32, "Hello World!");

maUpdateScreen();
The first line sets the color to white. 0xFFFFFF represents full intensity for red, green and blue. If you're not familiar with this way of representing colors you will find more information about it in the graphics tutorial.
The second line renders the text "Hello World!" to the backbuffer on the coordinates x=0 and y=32. Because it is drawing to a backbuffer, the text will not be visible directly.
The third line renders the contents of the back buffer to the screen. (If you forget to add the maUpdateScreen function to your program, you will only have a black screen!)

In the function keyPressEvent, we have added these lines:

if(keyCode == MAK_0)
maExit(0);
The first line checks if the pressed key is MAK_0 (which is the zero button on your device's keypad). If that is true, the second line is executed, exiting the Moblet.
(There is also a skeleton for a function that gets notified when a key is released. Read more about the Moblet template in Event-Driven, OO Applications and learn more in our tutorial Starting a New Moblet Project.)
Your application is now ready to run.





Running your Application

To compile your project and run it in the MoSync emulator, click the Run button (or Ctrl-F11):








No comments:

Post a Comment