Difference between revisions of "MAP524/DPS924 Lecture 2"

From CDOT Wiki
Jump to: navigation, search
(Configuring your system)
Line 18: Line 18:
  
 
If you don't do that you'll still be able to use your device, but you'll need to use it as the root user instead.
 
If you don't do that you'll still be able to use your device, but you'll need to use it as the root user instead.
 +
 +
= Rooting and unlocking =
 +
 +
This is a complex topic that we don't need to dig into because you don't need a rooted or unlocked device to do development on it. But it's important for you to know what these terms mean:
 +
 +
* Unlocking the phone usually means unlocking it from a specific service provider. When you buy a phone from a telecom (perhaps at a discount) that phone will only work on that provider's network (it's locked to it). You can pay for a code that will unlock the device from that network and then use it with other providers.
 +
* An unrelated thing you can unlock is the boot loader. Devices have a locked boot loader by default which means you will be unable to boot an alternate operating system or make any changes to the system image. This is accomplished with public key cryptography. The process for unlocking the boot loader is different for every device.
 +
* A rooted phone has the "su" command, which will let you run commands as root on the phone. You need to unlock the boot loader before you can root a phone. A rooted phone is great for development if you do more system-level programming rather than just writing apps.

Revision as of 14:05, 2 July 2015

Developing on a real device

You don't need to get a special development device in order to do development work on it. Pretty much any phone or tablet can be used for regular application development, you just need to make sure it has the version of Android you need on it.

Configuring your device

To enable your phone/tablet to be used as a developement device follow these steps:

  • In the "Developer options" settings you need to enable "USB debugging" to allow you to connect to the device using ADB.
    • If you don't see developer options - they are hidden by default and getting them to show varies on different devices. On a Nexus you go to "About phone" and tap "Build number" seven times.
  • Then you also need to allow your phone to install the apps you build. Go to the "Security" settings and enable installing from "Unknown sources". This way you don't need to go through the trouble and expense of signing your application and publishing them on Google Play.

Note that for security reasons you shouldn't keep the USB debugging option turned on permanently. It's not easy to abuse but it can be done.

Configuring your system

If you have your own Linux system (not the ICT USB Stick) you'll have to allow your user to read and write directly to a USB device. To do this simply add this file to your /etc/udev/rules.d/ directory: 51-android.rules

If you don't do that you'll still be able to use your device, but you'll need to use it as the root user instead.

Rooting and unlocking

This is a complex topic that we don't need to dig into because you don't need a rooted or unlocked device to do development on it. But it's important for you to know what these terms mean:

  • Unlocking the phone usually means unlocking it from a specific service provider. When you buy a phone from a telecom (perhaps at a discount) that phone will only work on that provider's network (it's locked to it). You can pay for a code that will unlock the device from that network and then use it with other providers.
  • An unrelated thing you can unlock is the boot loader. Devices have a locked boot loader by default which means you will be unable to boot an alternate operating system or make any changes to the system image. This is accomplished with public key cryptography. The process for unlocking the boot loader is different for every device.
  • A rooted phone has the "su" command, which will let you run commands as root on the phone. You need to unlock the boot loader before you can root a phone. A rooted phone is great for development if you do more system-level programming rather than just writing apps.