[Type the company name] nsf mobile Security Workshop 2014

Download 312.97 Kb.
Size312.97 Kb.
  1   2   3   4

[Type the company name]

NSF Mobile Security Workshop 2014

Sponsored by NSF #1241651

University of Tennessee at Chattanooga, Southern Polytechnic State University, University of Cincinnati, Tuskegee University


Mobile Security Workshop Hands-on Lab Manual


Mobile Security Workshop Hands-on Lab Manual 2

Lab 1 Getting Started with Mobile App Development 3

Android Development Environment Set Up 3

Simple Android App Development 3

Take a screenshot on your android device via Eclipse: 22

Android App Deployment 22

Lab 2 Encryption/decryption with key pair 23

Demo 40

Lab 3 Malware-Game 43

Lab 3 Malware Game – Step by Step demonstration 46

Lab 4 Malware-Trojan 67

The Development of the Android Trojan 67

Lab 4 Step-by-Step Demonstration 72

Lab 5 Database Security 81

SQL injection and defense 81

Lab 1 Getting Started with Mobile App Development

Android Development Environment Set Up

Simple Android App Development

In this tutorial, we will learn to create a "Hello User" application. User can enter a text into the textbox, then click the button. The application will get the value from the textbox and display the hello message on the screen. The application will also print out the current time and date.


The Object Oriented programming is the most current way of programming. The concept of OO is now applied to not only programming, but also database system, interactive interface, application structure, and various areas. This tutorial will help students to understand how the OO programming works, how convenience the OO programming is. Students will easily start to get into the concept of OO programming and use it into the future programming.

Software Requirement

  • Eclipse IDE

  • Java JDK, JRE

  • Android SDK


Open Eclipse

(For purposes of this workshop, the correct configuration of Eclipse is located under the downloads folder)

Double click here

Open the Eclipse folder

Double click here

Open Eclipse

Double click here

You will be asked to create a workspace. I am storing mine under my name: After typing a name click OK. It will take a little time to load the tools.

You are now ready to create a new android project. Your screen should look something like this:

Click New Android Application.

You should see a screen that looks like this.

Project Name: Hello_world – the application name will automatically fill.
Target Name:
Android 2.3 ->Selected this from "Target SDK"
Package Name:

Your screen should now look like this.

Click Next three times till you get a screen that looks like the following:

Make sure Blank Activity is selected and click Next.

Fill in the Activity Name as Hello_worldActivity. (This is basically Java so it is case sensitive) We are looking for these names in later labs so make sure you keep to the correct naming convention). This generates the .java code we will be using later.

Change the LayoutName to main. This generates the layout.xml code we will use later.

Navigation Type should stay None

Fragment Layout Name should stay the same.

When completed, you screen should look like this.

Click Finish.

Eclipse will process for a few minutes.

Your screen should look something like the following.

Notice that we are in the fragment_hello_world-activity.xml and we are in the Graphical Layout.

Note: If you are not on this screen. Open the folder res and select the layout folder and select the fragment_hello_world_activity.xml.

Now we are going to add some things to our screen.

  • From the Forms Widget, select the text view and drag it to the graphic of your phone.

  • Next move to the Text Fields folder and drag a field to you phone graphic. I chose person name.

  • Next we are going to create a button. Go back to the Forms Widget and drag a button to your phone graphic.

Right click on the button from graphical layout, select Other Properties -> Inherited From View -> OnClick. You should then see a box that looks like the following:

Type onclick (case sensitive) in the blank box to set the OnClick value and click OK.

You should be back to the main screen. Go to file and hit SAVE.

We are now ready to add the code which we have provided.

  • Go to Hello_world -> src

  • Select the android.hello_world

  • Double Click Hello_worldActivity.java

You should see the following:

Making sure you are in the Hello_worldActivity.java tab, delete all the code.

Copy and paste the following code in “Hello_worldActivity.java

package android.hello_world;


import android.app.Activity;

import android.os.Bundle;

import java.text.DateFormat;

import java.util.Date;


import android.view.View;

import android.widget.EditText;

import android.widget.TextView;

 public class Hello_worldActivity extends Activity {

    EditText text1;

    TextView view1;

    /** Called when the activity is first created. */


    public void onCreate(Bundle savedInstanceState) {


        setContentView(R.layout.main); //this name should //follow your xml file's name in layout document.




    public void onclick(View view)


       String currentDateTimeString = DateFormat.getDateInstance().format(new Date());


           view1.setText("Hello! Default user! \r\n Now is "+currentDateTimeString);




           view1.setText("Hello! " + text1.getText().toString() + "\r\n Now is " + currentDateTimeString);






After copying the data save the file. Go to FileSave.

Next we need to copy data into the AndroidManifest.xml. You will notice there are more than one AndroidManifest.xml files. We want the one under bin.

Click on the AndroidManifest.xml file. You should see the following:

If you do not, try clicking on the tab marked AndroidMainfest.xml.

Delete all the code.

Copy and paste the following code into AndroidManifest.xml.

android:versionName="1.0" >

android:label="@string/app_name" >
android:label="@string/app_name" >

Save the file.

Lastly, we need to modify the main.xml. Go to main.xml. It is located under the res folder, under the layout folder.

Double click to open the file. Again, you may have click on the main.xml tab to get to the code. Delete the existing code and insert the following in its place.









    tools:context=".HelloWorldActivity" >








        android:layout_marginTop="158dp" />






        android:layout_marginLeft="18dp" />



You are now ready to run the code. (These machines are setup with the emulator pre-installed. If you are running under the emulator mode, you would have to do this on your machines.)

To run the code, click on the run and select Run as:

Save and run the project, enter your name in to the textbox, click the “Submit” button, the result will be like this.



To run on a real device:


Download 312.97 Kb.

Share with your friends:
  1   2   3   4

The database is protected by copyright ©ininet.org 2023
send message

    Main page