Using Device Profiles
MoSync comes with a comprehensive set of device profiles to help you deploy your applications to the widest possible range of mobile devices. Each device profile defines the characteristics and capabilities of a single mobile device. Device profiles are used by MoSync's MoRE emulator and during the build process to dynamically tailor the application to a particular device.
About Device Profiles
MoSync comes with hundreds of device profiles, categorized by vendor. Each device profile holds important information about the characteristics of target mobile device, including information such as:
- Screen dimensions
- Memory capacity
- Supported features (for example, Bluetooth)
The available device profiles are shown on the Device Profiles tab in the IDE:
When you start a new project, the active device profile is always the profile for the MoSync emulator. (You can find this profile in the Device Profile view under Mobile Sorcery > Emulator.)
Changing the Current Device Profile
The current device profile is highlighted with an orange background to its icon.
To change the current device profile, right-click on the name of a device in the Device Profile view and select Set Target Phone.

Viewing Device Profile Information
If you want to see more information about a particular device, select Show Profile Info from the right-click menu. You will then see the header file that MoSync will use when it builds the application for the emulator:

Filtering Device Profiles
You can filter the list of device profiles so that only a subset of the full device profile list is shown in the Device Profiles view so that, when you build your application, packages will only be built for the devices listed.
You can set more than one filter: setting the right combination of filters enables you to build only for the devices that meet the exact requirements of your application.
To set a filter, click the Add button beneath the Device Profiles view. The Select Filter Type window will open:

The first option is Vendor/Device. Here it's possible to choose which vendors and devices you want to include or exclude from your profiles. Use the checkboxes to select the combination of vendors and devices you require.

The second option is Feature/Bug. Here it's possible to include and exclude devices according to the features and bugs that we know exist on the various devices. It's also possible to select device operating systems through this option:

The third option is Device Constant Condition. These are constant values set in all devices. They include the screen sizes and the available heap sizes of the various devices:

By using multiple filters you can select the devices that satisfy the requirements for your application. Mutliple filters are combined using the AND operator: a device is listed only if it satisfies the conditions of all filters.
Editing and Removing Filters
To remove or edit a currently applied filter, highlight the filter beneath the Device Profiles view, then click Remove or Edit.

Accessing Device Profiles in your Code
To access device profile definitions in your C/C++ code, include the maprofile header file:
#include <maprofile.h>
Useful profile definitions include MA_PROF_STRING_VENDOR and MA_PROF_STRING_DEVICE, which are the names of the device and its vendor.
For writing vendor-specific or device-specific code, MA_PROF_VENDOR_* and MA_PROF_DEVICE_* definitions are also available. For example MA_PROF_VENDOR_NOKIA and MA_PROF_DEVICE_6630.
MA_PROF_SUPPORT_JAVAPACKAGE_BLUETOOTH is defined if and only if the device supports Bluetooth.
MA_PROF_CONST_SCREENSIZE_X, MA_PROF_CONST_SCREENSIZE_Y are defined as integers that describe the screen size in pixels. MA_PROF_CONST_BITSPERPIXEL describes the color depth.
Showing the Device Profiles View
If you close the Device Profiles view you can reopen it again by selecting Window > Show View > Other > MoSync > Device Profiles.
- Printer-friendly version
- Login or register to post comments
Share on Facebook