FAU Android

FAU's local android experts!

Determining your Device’s Info in Java

Posted by Charles Norona August - 25 - 2010 - Wednesday Comments Off

Sooner or later there will come an instance where one is developing applications on Android and will have to provide some kind of mechanism for making their applications compatible with different hardware platforms. Reasons for using this class can vary from ensuring that the user interface looks proper across different resolutions, changing parameters within algorithms in order to optimize performance, etc. Fortunately, the Android engineers have provided developers the android.os.Build class which can be used to acquire this information. An example of its use is depicted below:


private String TAG = "SSLA";

...

//Determine the local device info for compatibility
Log.i(TAG, "Device information: \n" +
"Board: " + Build.BOARD + "\n" +
"Brand: " + Build.BRAND + "\n" +
"CPU: " + Build.CPU_ABI + "\n" +
"Device: " + Build.DEVICE + "\n" +
"Display: " + Build.DISPLAY + "\n" +
"Fingerprint: " + Build.FINGERPRINT + "\n" +
"Host: " + Build.HOST + "\n" +
"ID: " + Build.ID + "\n" +
"Manufacturer: " + Build.MANUFACTURER + "\n" +
"Model: " + Build.MODEL + "\n" +
"Product: " + Build.PRODUCT + "\n" +
"Tags: " + Build.TAGS + "\n" +
"Time: " + Build.TIME + "\n" +
"Type: " + Build.TYPE + "\n" +
"User: " + Build.USER);

//Example application of using the Build class.
if ((Build.MODEL.equals("T-Mobile G1"))
|| (Build.MODEL.equals("HTC Dream"))
|| (Build.MODEL.equals("Era G1")))//T-Mobile G1 or HTC Dream
slideRate = 6;
else if (Build.MODEL.equals("Nexus One"))//Google Nexus One
slideRate = 4;
else//Default sliding background rate.
slideRate = 4;

The giant log statement produces the following output on the DDMS Logcat:

Output showing use of Build class.

Unit and Functional Testing in Android

Posted by Mihai April - 13 - 2010 - Tuesday Comments Off

Testing should be an integral part of the development process, no matter on what platform and what programming language you are using. Two flavors of testing were described to students:

  • Unit Testing, where you test your code to see if it runs correctly, and
  • Functional Testing, making sure that your system complies with the functional requirements.

Unit testing tells the developer that the code is doing things right, while functional testing tell a developer that the code is doing the right things.

If you are interested in this topic, and what has been discussed in class, please visit my blog post at http://mihaifonoage.blogspot.com/2010/01/unit-and-functional-testing-in-android.html.