Tuesday, July 5, 2011

Reader Feedback: Using Your Personal Device for Development

We had an interesting comment come in from a reader recently. In our books, work, and discussions with developers and clients, we always strongly recommend testing applications on real hardware -- as much real hardware as you can feasibly get your hands on.

Why? Won't the Android code just run everywhere?

Sure, the code will run everywhere. The results, however, will not be consistent. It doesn't mean that your app will run properly or as you expect it to. This can be due to different device SDK versions, bugs in your own code, unexpected device differences (such as strange screen resolutions or manufacturer features that modify behavior slightly), and simply device firmware bugs.

Back to the reader comment:

"... because there was no mention if it would have any impact on the device.  What I mean is, will it reload all the device programs and possibly mess up my phone?"

This is a great question. Having done mobile development -- and used personal devices for testing, in addition to piles of test-only devices -- for over a decade, we often forget about such basic things. Once upon a time we worried about such issues - typically we worried most about "bricking" our phones, or causing them to become unusable.

The simple answer with Android is no, writing and deploying apps won't mess up your personal device. Well, no more so than you could mess up your device by installing someone else's poorly written app. The more complex answer is that it could, but it depends on what you're doing. If you're just loading your own applications and running them, even on the debugger, that alone won't cause problems. If you're doing something tricky with your code, going beyond the bounds of the SDK, or other lower level items, you could cause resets, instability, and even data loss -- but simply due to bugs in your code.

One caveat here is that at no time in our books or articles do we recommend rooting your device, which opens it up to higher chances of causing damage. Rooting your device gives you access to underlying systems and services that are made unavailable to developers for good reason. Yes, there can be reasons to root your device, but those who pursue this do so at their own risk. Our general feeling is that testing with rooted devices is not useful, because the majority of users in the world don't root their devices, and that's the environment our apps will run on and therefore the environment our apps should be tested on.

We do recommend backing up your data. For instance, if you're writing an app that reads and writes to the device images and you have a bunch of family photos on the device that you haven't backed up, do so. Same goes for working with contacts, etc. Maybe one of your apps accidentally deletes everything during testing. That wouldn't be any fun, would it? Therefore, your biggest vulnerability when using a personal device is the data, not the device itself.

Further, you can still use your device for purchasing items off the app stores: Android Market, Amazon appstore, and any others you'd like. Again, using a device for development does not require rooting that device, so you can still purchase books and movies that are sometimes blocked on rooted devices.

Finally, even the carriers/operators won't know or care. It's not really any different than loading apps from alternate markets. If you're developing an application that uses a ton of data over cellular connections, you might need to make sure you have a data plan that includes a lot of bandwidth, or unlimited usage, to avoid hefty fees.

Ultimately, our own personal devices are the ones we test or demo apps on the most because they are always with us and are the most convenient. We don't have to sift through boxes of cables and devices if we're using our personal devices.

1 comment:

Laurie Darcey said...

One other thing I thought of: if you're trying something tricky or sketchy, start by using the emulator!