Mobile Devices Application Software DevelopmentThe important factors of the conventions to simplify mobile-device software development. There are several factors to account for when writing software for mobile and embedded devices, and when developing for Android,
Hardware-Imposed Design ConsiderationsSmall and portable, mobile devices offer exciting opportunities for software development. Their limited screen size and reduced memory, storage, and processor power are far less exciting, and instead present some unique challenges.
Compared to desktop or notebook computers, mobile devices have relatively:
1. Low processing power
2. Limited RAM
3. Limited permanent storage capacity
4. Small screens with low resolution
5. Higher costs associated with data transfer
6. Slower data transfer rates with higher latency
7. Less reliable data connections
8. Limited battery life
Itís important to keep these restrictions in mind when creating new applications.
Be EfficientManufacturers of embedded devices, particularly mobile devices, value small size and long battery life over potential improvements in processor speed. For developers, that means losing the head start traditionally afforded thanks to Mooreís law. The yearly performance improvements youíll see in desktop and server hardware usually translate into smaller, more power-efficient mobiles without much improvement in processor power. In practice, this means that you always need to optimize your code so that it runs quickly and responsively, assuming that hardware improvements over the lifetime of your software are unlikely to do you any favors.
Expect Limited CapacityAdvances in fl ash memory and solid-state disks have led to a dramatic increase in mobile-device storage capacities. In practice, most devices still offer relatively limited storage space for your applications. While the compiled size of your application is a consideration, more important is ensuring that your application is polite in its use of system resources. You should carefully consider how you store your application data. To make life easier, you can use the Android databases and Content Providers to persist, reuse, and share large quantities of data, Android provides an optimized framework
Techniques like caching are useful for limiting repetitive network lookups, but donít leave files on the file system or records in a database when theyíre no longer needed.
Design for Small ScreensThe small size and portability of mobiles are a challenge for creating good interfaces, particularly when users are demanding an increasingly striking and information-rich graphical user experience. Write your applications knowing that users will often only Small Screen. Make your applications intuitive and easy to use by reducing the number of controls and putting the most important information front and center. If youíre planning to include touch-screen support youíll need to consider how touch input is going to affect your interface design. The time of the stylus has passed; now itís all about finger input, so make sure your Views are big enough to support interaction using a finger on the screen. Mobile phone resolutions and screen sizes are increasing, so itís smart to design for small screens, but also make sure your UIs scale.
Expect Low Speeds, High LatencyThe ability to incorporate some of the wealth of online information in your applications is incredibly powerful. When youíre developing your Internet-based applications, itís best to assume that the network connection will be slow, intermittent, and expensive. With unlimited 3G data plans and city-wide Wi-Fi, this is changing, but designing for the worst case ensures that you always deliver a high-standard user experience. This also means making sure that your applications can handle losing a data connection.
The Android Emulator lets you control the speed and latency of your network connection when setting up an Eclipse launch configuration. Your experiment has to ensure responsiveness no matter what the speed, latency, and availability of network access. You might find that in some circumstances, itís better to limit the functionality of your application or reduce network lookups to cached bursts, based on the network connections available.
Application CostItís a good approach to assume that thereís a cost associated with any action involving an interaction with the outside world. Minimize interaction costs by the following:
1. Transferring as little data as possible
2. Caching data and GPS results to eliminate redundant or repetitive lookups
3. Stopping all data transfers and GPS updates when your activity is not visible in the foreground if theyíre only being used to update the UI
4. Keeping the refresh/update rates for data transfers (and location lookups) as low as practicable
5. Scheduling big updates or transfers at Ďoff peakí times using alarms
User EnvironmentYou canít assume that your users will think of your application as the most important feature of their phones. Generally, a mobile is first and foremost a phone, secondly an SMS and e-mail communicator, thirdly a camera, and fourthly an MP3 player. The applications you write will most likely be in a fifth category of ďuseful mobile tools.Ē Make sure that your applications donít distract them any more than necessary.
1. Is well behaved
Start by ensuring that your Activities suspend when theyíre not in the foreground. Android provides a Service class designed to run in the background without the UI overheads.
2. Switches seamlessly from the background to the foreground
With the multitasking nature of mobile devices, itís very likely that your applications will regularly switch into and out of the background. When this happens, itís important that they ďcome to lifeĒ quickly and seamlessly. This should be invisible to the user. You can ensure this by saving the application state and queuing updates so that your users donít notice a difference between restarting and resuming your application. Switching back to it should be seamless with users being shown the exact UI and application state they last saw.
3. Is polite
Your application should never steal focus or interrupt a userís current activity. Use Notifications and Toasts instead to inform or remind users that their attention is requested if your application isnít in the foreground. There are several ways for mobile devices to alert users. For example, when a call is coming in, your phone rings; when you have unread messages, the LED fl ashes; and when you have new voice mail; a small "mail" icon appears in your status bar. All these techniques and more are available through the notification mechanism.
4. Presents a consistent user interface
Your application is likely to be one of several in use at any time, so itís important that the UI you present is easy to use. Donít force users to interpret and relearn your application every time they load it. Using it should be simple, easy, and obvious, particularly given the limited screen space and distracting user environment.
5. Is responsive
Responsiveness is one of the most important design considerations on a mobile device. Youíve no doubt experienced the frustration of a "frozen" piece of software; the multifunction nature of a mobile makes it even more annoying. With possible delays due to slow and unreliable data connections, itís important that your application use worker threads and background services to keep your activities responsive and, more importantly, stop them from preventing other applications from responding in a timely manner.