IT tutorials
 
Mobile
 

Java ME on Symbian OS : Handling Diversity - Detecting Diversity using Properties

2/18/2013 6:30:24 PM
- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire

1. General Approaches to Handling Diversity

We have a range of possible options for handling diversity. At opposite ends of the scale, we have the multiple-implementations approach and the feature-drop approach. Both are quite extreme when it comes to Java ME on Symbian OS, which has much in common across the various devices.

The multiple-implementations approach implies fundamentally different implementations of the same functionality and the need to maintain multiple JARs. Taking this approach further means that, for each device model, you need to maintain a JAR file. The multiple-implementations approach usually starts with being uneconomical and ends up as being impractical. It should therefore be avoided.

The feature-drop approach implies that you totally remove a feature from the application, which is very harsh, unless it is a case of a JSR that is not supported. That might happen on Symbian OS but, generally, JSR support on Symbian smartphones is very predictable.

The multiple-implementation and feature-drop approaches are more suitable for handling fragmentation than diversity. Between these two extremes, there are a few more moderate approaches that can be combined to produce the fewest variants to cover most Symbian smartphones. These are techniques such as:

  • Detection: The Java ME capabilities can be detected at various stages, each involving different types of required action. We utilized detection with the Java ME Detectors suite and we use similar techniques.

  • Adaptive code: Code that can handle variants in a simple way, without major refactoring or code instrumentation is termed 'adaptive code'. The same simple code can handle differences that may occur on devices coming from different Symbian OS UI platforms.

  • Flexible and modular design: There are endless options when you take this route. For example, you can create abstraction layers, apply design patterns, or decouple functionality into modular subsystems.

Now we look at various areas in which diversity appears and examine how to handle it in simple ways that combine those three approaches.

2. Detecting Diversity using Properties

System properties can be retrieved using the System.getProperty() method, which receives as a key the name of a system property and returns its value (or NULL if there is no property with that key). The system properties are logically grouped into properties that give information about the environment, package discovery, JSR capabilities and the device-specific properties.

Figure 1. Environment system properties on a) Nokia N95 and b) Sony Ericsson W960i

You can get information about the Java ME environment (see Figure 1), for example:

  • microedition.profiles is a list of the profiles that the device supports. For MIDP 2.0 devices, this property contains at least MIDP-2.0.

  • microedition.platform returns the identifier of the platform (e.g., you can identify whether you are running on the Nokia N95 or Sony Ericsson W960i).

  • fileconn.dir.photos points to the directory where photos captured with an integrated camera or other images are stored (it returns file:///C:/Data/Images/).

You can also check versions of supported JSRs. For example, micro-edition.media.version and microedition.pim.version indicate if the optional packages are supported. If they are, a version string is returned (e.g. "1.1"), as shown in Figure 2.

Figure 2. Support for optional packages

You can query about JSR capabilities (Figure 3). For example, supports.mixing returns true or false depending on whether MMAPI audio mixing is supported.

Figure 3. Support for JSR capabilities

There are ways to get JSR-specific information through system properties. JSR-184 Mobile 3D Graphics API properties can be queried with the Graphics3D.getProperties() method, which returns a hash-table of 3D graphics support properties and their values (see Figure 4a). In the Bluetooth API, LocalDevice.getProperty() should return properties that are specific to Bluetooth support such as the maximum number of connections (see Figure 4b).

Figure 4. System properties for a) the Mobile 3D Graphics API and b) the Bluetooth API

The device-specific system properties can give you additional information which is proprietary to a device or manufacturer. For example, S60 3rd Edition FP2 and S60 5th Edition system properties include support for telephony-related information, such as the International Mobile Equipment Identity (IMEI) number, International Mobile Subscriber Identity (IMSI) number, current (GSM/CDMA) network signal strength and more.

There is a lot of information available to you through detection, whether you detect it through a thrown exception or through system properties. The general idea is to use detection to configure your application's behavior. Use the information you gain from detection to decide on the application behavior and actions that are affected.

 
Others
 
- BlackBerry Bold 9700 and 9650 Series : Email Set Up - Sync Google Contacts Using Email Setup
- BlackBerry Bold 9700 and 9650 Series : Email Set Up - Maintaining Your Email Accounts
- iPhone Programming : Other Native Platforms - MonoTouch
- iPhone Programming : Other Native Platforms - PhoneGap
- Windows Phone 8 : Phone-Specific Controls (part 2) - Pivot Control
- Windows Phone 8 : Phone-Specific Controls (part 1) - Panorama Control
- BlackBerry Tablet Applications : Exploring the APIs - Busy Indicator
- BlackBerry Tablet Applications : Exploring the APIs - Multi-Touch
- BlackBerry Tablet Applications : Exploring the APIs - Microphone
- Android : Getting Fancy with Lists - Inflating Rows Ourselves
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
programming4us programming4us
 
Popular tags
 
Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS
Celebrity Style, Fashion Trends, Beauty and Makeup Tips.