Thinking Beyond the Application Boundaries

At times, the device may perform extraneous work that can affect your application, such as downloading a large file in the background while playing music from an online radio application. Will these heavy network-bound activities affect the application in any way? It depends. If your app needs a connection to the Internet and for some reason cannot connect, will it crash? What will happen? Knowing the answers to these questions means that you’re thinking beyond your application boundaries.

Not all apps are created equal — some good ones are out there, along with some bad ones. Before building or releasing your first Android application, ensure that you know the ins and outs of your application and anything that can affect it. Be sure that the app doesn’t crash when users perform routine tap events and screen navigation.

Building applications on embedded devices is much different from building them on a PC or Mac, and the reason is simple: The resources (memory and processor, for example) are limited. If the Android device happens to be a phone, its main purpose is to perform phone-like duties, such as recognizing an incoming call, maintaining a signal, and sending and receiving text messages.

If a phone call is in progress, the Android system treats that process as vital, whereas a downloading file in the background is considered nonvital. If the phone starts to run out of resources, Android kills all nonvital processes to keep the vital ...

Get Android Application Development For Dummies, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.