SlideShare a Scribd company logo
Women in Digital
Empowerment through Technology
www.widbd.com
Achia Nila
Founder, Women in Digital
www.widbd.com
IN THE BEGINNING…
MOTOROLA DYNATAC 8000X
www.widbd.com
EARLY SMART PHONES
www.widbd.com
WHAT IS A “SMARTPHONE”
• Semi-Smart: Phone that offers features beyond
making calls
1. E-mail
2. Take pictures
3. Plays mp3
• Phone that runs a complete Operating System
1. Offers a standardized platform for development
2. Able to execute arbitrary 3rd party applications
www.widbd.com
• Today
1. Cell phones in use today ~ 1.2 billion
2. Smartphones account for 14% ~ 170 Million
QUICK FACTS
• Projected 2012
1. Cell phones ~ 1.7 billion
2. Smartphones 29% ~ 500 Million
• 300% Smartphone growth in three years
www.widbd.com
Java ME
Symbian
UIQ
S60
Android
BlackBerry
OVI
Windows Mobile
iPhone
MOBILE DEVELOPMENT SOLUTIONS
LiMo
Ångström distribution
Adobe Flash Light
BREW
OpenMoko
Palm OS (Garnet OS, Cobalt OS)
Palm webOS
Mojo
www.widbd.com
What is Android
• Android is an operating system for mobile devices such
as smartphones and tablet computers. It is developed by the Open Handset
Alliance led by Google.
• Android has beaten Apple iOS, being the leading mobile operating system
from first quarter of 2011
• Version: Android 1.0, 1.1 to 1.5 (Cupcake), 1.6 (Donut), 2.0/2.1 (Eclair), 2.2
(Froyo), 2.3 (Gingerbread), to 3.0 (Honeycomb), 4.0 (Ice Cream
Sandwich), 5.0 (Lollipop)
www.widbd.com
Android Architecture
www.widbd.com
Outline
• Introduction to Android
• Getting Started
• Android Programming
www.widbd.com
Getting Started (1)
• Need to install Java Development Kit (JDK) to write
Java (and Android) programs
– Do not install Java Runtime Environment (JRE);
JDK and JRE are different!
• Can download the JDK for your OS at http://java.oracle.com
• Alternatively, for OS X, Linux:
– OS X:
• Open /Applications/Utilities/Terminal.app
• Type javac at command line
• Install Java when prompt appears
– Linux:
• Type sudo apt–get install default–jdk at command line
(Debian, Ubuntu)
• Other distributions: consult distribution’s documentation
www.widbd.com
Install!
11
Getting Started (2)
• After installing JDK, download Android SDK from
http://developer.android.com
• Simplest: download and install Android Studio bundle (including Android
SDK) for your OS
• Alternatives:
– Download/install Android Developer Tools from this site (based on
Eclipse)
– Install Android SDK tools by themselves, then install ADT for Eclipse
separately (from this site)
• We’ll use Android Studio with SDK included (easy)
12
www.widbd.com
13
Install!
13
www.widbd.com
14
Getting Started (3)
• Install Android Studio directly (Windows, Mac); unzip to directory
android-studio, then run ./android-studio/bin/studio.sh (Linux)
• You should see this:
14
www.widbd.com
15
www.widbd.com
Getting Started (4)
• Strongly recommend testing with
real Android device
– Android emulator: very slow
– Faster emulator: Genymotion
[14], [15]
– Install USB drivers for your
Android device!
• Bring up the Android SDK
Manager
– Recommended: Install
Android 2.2, 2.3.3 APIs and
4.x API
– Do not worry about Intel x86
Atom, MIPS system images
Settings
Now you’re ready for Android development!
15
Android Highlights (2)
• Android apps written in Java 5
– Actually, a Java dialect (Apache Harmony)
– Everything we’ve learned still holds
• Apps use four main components:
– Activity: A “single screen” that’s visible to user
– Service: Long-running background “part” of app (not separate process
or thread)
– ContentProvider: Manages app data (usually stored in database) and
data access for queries
– BroadcastReceiver: Component that listens for particular Android
system “events”, e.g., “found wireless device”, and responds
accordingly
16
www.widbd.com
App Manifest
• Every Android app must include an AndroidManifest.xml file describing
functionality
• The manifest specifies:
– App’s Activities, Services, etc.
– Permissions requested by app
– Minimum API required
– Hardware features required, e.g., camera with autofocus
– External libraries to which app is linked, e.g., Google Maps library
17
www.widbd.com
Activity Lifecycle
• Activity: key building block of
Android apps
• Extend Activity class, override
onCreate(), onPause(),
onResume() methods
• Dalvik VM can stop any Activity
without warning, so saving state is
important!
• Activities need to be “responsive”,
otherwise Android shows user
“App Not Responsive” warning:
– Place lengthy operations in
Runnable Threads,
AsyncTasks
Source: [12]18
www.widbd.com
App Creation Checklist
• If you own an Android device:
– Ensure drivers are installed
– Enable developer options on device under Settings, specifically USB
Debugging
• Android 4.2+: Go to Settings→About phone, press Build number 7
times to enable developer options
• For Android Studio:
– Under File→Settings→Appearance, enable “Show tool window bars”;
the Android view shows LogCat, devices
– Programs should log states via android.util.Log’s
Log.d(APP_TAG_STR, “debug”), where APP_TAG_STR is a final
String tag denoting your app
– Other commands: Log.e() (error); Log.i() (info); Log.w() (warning);
Log.v() (verbose) – same parameters
19
www.widbd.com
Creating Android App (1)
• Creating Android app project in
Android Studio:
– Go to File→New Project
– Enter app, project name
– Choose package name using
“reverse URL” notation, e.g.,
edu.osu.myapp
– Select APIs for app, then click
Next
20
www.widbd.com
Creating Android App (2)
• Determine what kind of Activity to
create; then click Next
– We’ll choose a Blank Activity
for simplicity
• Enter information about your
Activity, then click Finish
• This creates a “Hello World” app
21
www.widbd.com
Deploying the App
• Two choices for deployment:
– Real Android device
– Android virtual device
• Plug in your real device; otherwise,
create an Android virtual device
• Emulator is slow. Try Intel
accelerated version, or perhaps
http://www.genymotion.com/
• Run the app: press “Run” button in
toolbar
22
www.widbd.com
Underlying Source Code
package edu.osu.helloandroid;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
src/…/MainActivity.java
23
www.widbd.com
Underlying GUI Code
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
</RelativeLayout>
res/layout/activity_main.xml
– RelativeLayouts are quite complicated. See [13] for details
24
www.widbd.com
The App Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="edu.osu.helloandroid"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="edu.osu.helloandroid.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
AndroidManifest.xml
25
www.widbd.com
A More Interesting App
• We’ll now examine an app with
more features: WiFi Tester (code
on class website)
• Press a button, scan for WiFi
access points (APs), display them
26
www.widbd.com
Underlying Source Code (1)
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_wi_fi);
// Set up WifiManager.
mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
// Create listener object for Button. When Button is pressed, scan for
// APs nearby.
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
boolean scanStarted = mWifiManager.startScan();
// If the scan failed, log it.
if (!scanStarted) Log.e(TAG, "WiFi scan failed...");
}
});
// Set up IntentFilter for "WiFi scan results available" Intent.
mIntentFilter = new IntentFilter();
mIntentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
}
27
www.widbd.com
Underlying Source Code (2)
• Code much more complex
• First get system WifiManager
• Create listener Object for button
that performs scans
• We register Broadcast Receiver,
mReceiver, to listen for
WifiManager’s “finished scan”
system event (expressed as Intent
WifiManager.SCAN_RESULTS_
AVAILABLE_ACTION)
• Unregister Broadcast Receiver
when leaving Activity
@Override
protected void onResume()
{
super.onResume();
registerReceiver(mRecei
ver, mIntentFilter);
}
@Override
protected void onPause()
{
super.onPause();
unregisterReceiver(mReceiver);
}
28
www.widbd.com
The Broadcast Receiver
private final BroadcastReceiver mReceiver = new BroadcastReceiver()
{
@Override
public void onReceive(Context context, Intent intent)
{
String action = intent.getAction();
if (WifiManager.SCAN_RESULTS_AVAILABLE_ACTION.equals(action))
{
Log.e(TAG, "Scan results available");
List<ScanResult> scanResults = mWifiManager.getScanResults();
mApStr = "";
for (ScanResult result : scanResults)
{
mApStr = mApStr + result.SSID + "; ";
mApStr = mApStr + result.BSSID + "; ";
mApStr = mApStr + result.capabilities + "; ";
mApStr = mApStr + result.frequency + " MHz;";
mApStr = mApStr + result.level + " dBmnn";
}
// Update UI to show all this information.
setTextView(mApStr);
}
}
}; 29
www.widbd.com
User Interface
Updating UI in code
private void setTextView(String str)
{
TextView tv = (TextView)
findViewById(R.id.textview);
tv.setMovementMethod(new
ScrollingMovementMethod());
tv.setText(str);
}
•This code simply has the UI display all
collected WiFi APs, makes the text
information scrollable
UI Layout (XML)
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/button"
android:text="@string/button_text"/>
<TextView
android:id="@+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/ap_list"
tools:context=".WiFiActivity"
android:textStyle="bold"
android:gravity="center">
</TextView>
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".WiFiActivity"
android:id="@+id/textview"
android:scrollbars="vertical">
</TextView>
</LinearLayout>
30
www.widbd.com
Android Programming Notes
• Android apps have multiple points of entry: no main() method
– Cannot “sleep” in Android
– During each entrance, certain Objects may be null
– Defensive programming is very useful to avoid crashes, e.g.,
if (!(myObj == null)) { // do something }
• Java concurrency techniques are required
– Don’t block the “main” thread in Activities
– Implement long-running tasks such as network connections
asynchronously, e.g., as AsyncTasks
– Recommendation: read [4]; chapter 20 [10]; [11]
• Logging state via android.util.Log throughout app is essential when
debugging (finding root causes)
• Better to have “too many” permissions than too few
– Otherwise, app crashes due to security exceptions!
– Remove “unnecessary” permissions before releasing app to public
• Event handling in Android GUIs entails many listener Objects
31
www.widbd.com
www.widbd.com
References (1)
1. C. Horstmann, Big Java Late Objects, Wiley, 2012. Online:
http://proquest.safaribooksonline.
com.proxy.lib.ohio–state.edu/book/–/9781118087886
2. J. Bloch, Effective Java, 2nd ed., Addison–Wesley, 2008. Online: http://proquest.
safaribooksonline.com.proxy.lib.ohio–
state.edu/book/programming/java/9780137150021
3. S.B. Zakhour, S. Kannan, and R. Gallardo, The Java® Tutorial: A Short Course on the
Basics, 5th ed., Addison–Wesley, 2013. Online:
http://proquest.safaribooksonline.com.proxy.lib.
ohio–state.edu/book/programming/java/9780132761987
4. C. Collins, M. Galpin, and M. Kaeppler, Android in Practice, Manning, 2011. Online:
http://proquest.safaribooksonline.com.proxy.lib.ohio–
state.edu/book/programming/android/9781935182924
5. M.L. Sichitiu, 2011,
http://www.ece.ncsu.edu/wireless/MadeInWALAN/AndroidTutorial/PPTs/
javaReview.ppt
6. Oracle, http://docs.oracle.com/javase/1.5.0/docs/api/index.html
7. Wikipedia, https://en.wikipedia.org/wiki/Vehicle_Identification_Number
8. Nielsen Co., “Smartphone Milestone: Half of Mobile Subscribers Ages 55+ Own
Smartphones”, 22 Apr. 2014, http://www.nielsen.com/us/en/insights/news/2014/
smartphone-milestone-half-of-americans-ages-55-own-smartphones.html
32
www.widbd.com
Android
www.widbd.com
Android
www.widbd.com
Game
www.widbd.com
Game
Here's a rundown of some of the best game creators for making PC,
Android and iOS games.
1. GameSalad. ...
2. Stencyl. ...
3. GameMaker: Studio. ...
4. FlowLab. ...
5. Sploder. ...
6. ClickTeam Fusion 2.5. ...
7. Construct 2.
8. GameFroot.
www.widbd.com
Training & Workshop
www.widbd.com
Women in Digital Achievement (5 award)
Spark International Award BRAC Manthan Award
www.widbd.com
Women in Digital Achievement
Bangladesh Brand forum Award
www.widbd.com
Contact
Women In Digital
House 79, Road 3, Mohammadia Housing Limited ,Dhaka, Bangladesh
Phone: +880-163-549-7868
Email: info@widbd.com , womenindigitalbd@gmail.com
/WomeninDigital.net /wid_bd /widbd.Widbd.com
womenindigital womenindigital womenindigital
womenindigital
www.widbd.com
Thank You

More Related Content

PPTX
00 how to_test_app
PPTX
00 how to_test_app
PPTX
00 how to_test_app
PDF
Android Internals
PDF
Embedded Android Workshop at AnDevCon V
PDF
Embedded Android Workshop
PDF
Android complete basic Guide
PDF
Android Things: Android for IoT
00 how to_test_app
00 how to_test_app
00 how to_test_app
Android Internals
Embedded Android Workshop at AnDevCon V
Embedded Android Workshop
Android complete basic Guide
Android Things: Android for IoT

What's hot (20)

PDF
Android things introduction - Development for IoT
PPTX
Appcelerator Titanium Intro
PDF
Embedded Android Workshop with Nougat
PDF
Android Platform Debugging and Development
PDF
Android Platform Debugging and Development
PDF
Embedded Android Workshop at AnDevCon VI
PDF
Embedded Android Workshop with Nougat
PDF
LAP2 iOS and Android Development environment setup
PDF
Android Platform Debugging and Development
PDF
Is Android the New Embedded Linux? at AnDevCon VI
PPTX
Titanium Appcelerator - Beginners
PDF
Embedded Android Workshop at ABS 2014
PDF
Memory Management in Android
PDF
Embedded Android Workshop with Pie
PPTX
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...
ODP
Enhancing and modifying_the_core_android_os
PDF
Embedded Android Workshop with Nougat
PDF
Embedded Android Workshop at Embedded World 2014
PDF
Multitasking in iOS 7
PDF
Embedded Android Workshop with Marshmallow
Android things introduction - Development for IoT
Appcelerator Titanium Intro
Embedded Android Workshop with Nougat
Android Platform Debugging and Development
Android Platform Debugging and Development
Embedded Android Workshop at AnDevCon VI
Embedded Android Workshop with Nougat
LAP2 iOS and Android Development environment setup
Android Platform Debugging and Development
Is Android the New Embedded Linux? at AnDevCon VI
Titanium Appcelerator - Beginners
Embedded Android Workshop at ABS 2014
Memory Management in Android
Embedded Android Workshop with Pie
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...
Enhancing and modifying_the_core_android_os
Embedded Android Workshop with Nougat
Embedded Android Workshop at Embedded World 2014
Multitasking in iOS 7
Embedded Android Workshop with Marshmallow
Ad

Similar to Mobile application and Game development (20)

PDF
Android studio
PPT
Android class provider in mumbai
PPT
Synapseindia android apps intro to android development
PPT
Engineering and Industrial Mobile Application (APP) Development
PPT
Pertemuan 3 pm
PPTX
Android + training + philippines
PPTX
Android + training + philippines
PDF
Android development first steps
PPTX
Intro to android (gdays)
PPTX
Android OS & SDK - Getting Started
PPTX
Lecture 01: Introduction into Android.pptx
PDF
Mobile app development using Android SDK
PDF
Head first android_development
PPTX
Android app devolopment
PDF
Android101
PDF
Android presentation
PDF
Eca online-seminar-session-1.pptx
PPTX
Getting started with android programming
Android studio
Android class provider in mumbai
Synapseindia android apps intro to android development
Engineering and Industrial Mobile Application (APP) Development
Pertemuan 3 pm
Android + training + philippines
Android + training + philippines
Android development first steps
Intro to android (gdays)
Android OS & SDK - Getting Started
Lecture 01: Introduction into Android.pptx
Mobile app development using Android SDK
Head first android_development
Android app devolopment
Android101
Android presentation
Eca online-seminar-session-1.pptx
Getting started with android programming
Ad

Recently uploaded (20)

PDF
Machine learning based COVID-19 study performance prediction
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Cloud computing and distributed systems.
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Encapsulation theory and applications.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
Machine learning based COVID-19 study performance prediction
MIND Revenue Release Quarter 2 2025 Press Release
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Cloud computing and distributed systems.
sap open course for s4hana steps from ECC to s4
Building Integrated photovoltaic BIPV_UPV.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Network Security Unit 5.pdf for BCA BBA.
Understanding_Digital_Forensics_Presentation.pptx
Electronic commerce courselecture one. Pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Programs and apps: productivity, graphics, security and other tools
Encapsulation theory and applications.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
20250228 LYD VKU AI Blended-Learning.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Spectral efficient network and resource selection model in 5G networks
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”

Mobile application and Game development

  • 1. Women in Digital Empowerment through Technology www.widbd.com Achia Nila Founder, Women in Digital
  • 4. www.widbd.com WHAT IS A “SMARTPHONE” • Semi-Smart: Phone that offers features beyond making calls 1. E-mail 2. Take pictures 3. Plays mp3 • Phone that runs a complete Operating System 1. Offers a standardized platform for development 2. Able to execute arbitrary 3rd party applications
  • 5. www.widbd.com • Today 1. Cell phones in use today ~ 1.2 billion 2. Smartphones account for 14% ~ 170 Million QUICK FACTS • Projected 2012 1. Cell phones ~ 1.7 billion 2. Smartphones 29% ~ 500 Million • 300% Smartphone growth in three years
  • 6. www.widbd.com Java ME Symbian UIQ S60 Android BlackBerry OVI Windows Mobile iPhone MOBILE DEVELOPMENT SOLUTIONS LiMo Ångström distribution Adobe Flash Light BREW OpenMoko Palm OS (Garnet OS, Cobalt OS) Palm webOS Mojo
  • 7. www.widbd.com What is Android • Android is an operating system for mobile devices such as smartphones and tablet computers. It is developed by the Open Handset Alliance led by Google. • Android has beaten Apple iOS, being the leading mobile operating system from first quarter of 2011 • Version: Android 1.0, 1.1 to 1.5 (Cupcake), 1.6 (Donut), 2.0/2.1 (Eclair), 2.2 (Froyo), 2.3 (Gingerbread), to 3.0 (Honeycomb), 4.0 (Ice Cream Sandwich), 5.0 (Lollipop)
  • 9. www.widbd.com Outline • Introduction to Android • Getting Started • Android Programming
  • 10. www.widbd.com Getting Started (1) • Need to install Java Development Kit (JDK) to write Java (and Android) programs – Do not install Java Runtime Environment (JRE); JDK and JRE are different! • Can download the JDK for your OS at http://java.oracle.com • Alternatively, for OS X, Linux: – OS X: • Open /Applications/Utilities/Terminal.app • Type javac at command line • Install Java when prompt appears – Linux: • Type sudo apt–get install default–jdk at command line (Debian, Ubuntu) • Other distributions: consult distribution’s documentation
  • 12. Getting Started (2) • After installing JDK, download Android SDK from http://developer.android.com • Simplest: download and install Android Studio bundle (including Android SDK) for your OS • Alternatives: – Download/install Android Developer Tools from this site (based on Eclipse) – Install Android SDK tools by themselves, then install ADT for Eclipse separately (from this site) • We’ll use Android Studio with SDK included (easy) 12 www.widbd.com
  • 14. 14 Getting Started (3) • Install Android Studio directly (Windows, Mac); unzip to directory android-studio, then run ./android-studio/bin/studio.sh (Linux) • You should see this: 14 www.widbd.com
  • 15. 15 www.widbd.com Getting Started (4) • Strongly recommend testing with real Android device – Android emulator: very slow – Faster emulator: Genymotion [14], [15] – Install USB drivers for your Android device! • Bring up the Android SDK Manager – Recommended: Install Android 2.2, 2.3.3 APIs and 4.x API – Do not worry about Intel x86 Atom, MIPS system images Settings Now you’re ready for Android development! 15
  • 16. Android Highlights (2) • Android apps written in Java 5 – Actually, a Java dialect (Apache Harmony) – Everything we’ve learned still holds • Apps use four main components: – Activity: A “single screen” that’s visible to user – Service: Long-running background “part” of app (not separate process or thread) – ContentProvider: Manages app data (usually stored in database) and data access for queries – BroadcastReceiver: Component that listens for particular Android system “events”, e.g., “found wireless device”, and responds accordingly 16 www.widbd.com
  • 17. App Manifest • Every Android app must include an AndroidManifest.xml file describing functionality • The manifest specifies: – App’s Activities, Services, etc. – Permissions requested by app – Minimum API required – Hardware features required, e.g., camera with autofocus – External libraries to which app is linked, e.g., Google Maps library 17 www.widbd.com
  • 18. Activity Lifecycle • Activity: key building block of Android apps • Extend Activity class, override onCreate(), onPause(), onResume() methods • Dalvik VM can stop any Activity without warning, so saving state is important! • Activities need to be “responsive”, otherwise Android shows user “App Not Responsive” warning: – Place lengthy operations in Runnable Threads, AsyncTasks Source: [12]18 www.widbd.com
  • 19. App Creation Checklist • If you own an Android device: – Ensure drivers are installed – Enable developer options on device under Settings, specifically USB Debugging • Android 4.2+: Go to Settings→About phone, press Build number 7 times to enable developer options • For Android Studio: – Under File→Settings→Appearance, enable “Show tool window bars”; the Android view shows LogCat, devices – Programs should log states via android.util.Log’s Log.d(APP_TAG_STR, “debug”), where APP_TAG_STR is a final String tag denoting your app – Other commands: Log.e() (error); Log.i() (info); Log.w() (warning); Log.v() (verbose) – same parameters 19 www.widbd.com
  • 20. Creating Android App (1) • Creating Android app project in Android Studio: – Go to File→New Project – Enter app, project name – Choose package name using “reverse URL” notation, e.g., edu.osu.myapp – Select APIs for app, then click Next 20 www.widbd.com
  • 21. Creating Android App (2) • Determine what kind of Activity to create; then click Next – We’ll choose a Blank Activity for simplicity • Enter information about your Activity, then click Finish • This creates a “Hello World” app 21 www.widbd.com
  • 22. Deploying the App • Two choices for deployment: – Real Android device – Android virtual device • Plug in your real device; otherwise, create an Android virtual device • Emulator is slow. Try Intel accelerated version, or perhaps http://www.genymotion.com/ • Run the app: press “Run” button in toolbar 22 www.widbd.com
  • 23. Underlying Source Code package edu.osu.helloandroid; import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } } src/…/MainActivity.java 23 www.widbd.com
  • 25. The App Manifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="edu.osu.helloandroid" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="edu.osu.helloandroid.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> AndroidManifest.xml 25 www.widbd.com
  • 26. A More Interesting App • We’ll now examine an app with more features: WiFi Tester (code on class website) • Press a button, scan for WiFi access points (APs), display them 26 www.widbd.com
  • 27. Underlying Source Code (1) @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_wi_fi); // Set up WifiManager. mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE); // Create listener object for Button. When Button is pressed, scan for // APs nearby. Button button = (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { boolean scanStarted = mWifiManager.startScan(); // If the scan failed, log it. if (!scanStarted) Log.e(TAG, "WiFi scan failed..."); } }); // Set up IntentFilter for "WiFi scan results available" Intent. mIntentFilter = new IntentFilter(); mIntentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION); } 27 www.widbd.com
  • 28. Underlying Source Code (2) • Code much more complex • First get system WifiManager • Create listener Object for button that performs scans • We register Broadcast Receiver, mReceiver, to listen for WifiManager’s “finished scan” system event (expressed as Intent WifiManager.SCAN_RESULTS_ AVAILABLE_ACTION) • Unregister Broadcast Receiver when leaving Activity @Override protected void onResume() { super.onResume(); registerReceiver(mRecei ver, mIntentFilter); } @Override protected void onPause() { super.onPause(); unregisterReceiver(mReceiver); } 28 www.widbd.com
  • 29. The Broadcast Receiver private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (WifiManager.SCAN_RESULTS_AVAILABLE_ACTION.equals(action)) { Log.e(TAG, "Scan results available"); List<ScanResult> scanResults = mWifiManager.getScanResults(); mApStr = ""; for (ScanResult result : scanResults) { mApStr = mApStr + result.SSID + "; "; mApStr = mApStr + result.BSSID + "; "; mApStr = mApStr + result.capabilities + "; "; mApStr = mApStr + result.frequency + " MHz;"; mApStr = mApStr + result.level + " dBmnn"; } // Update UI to show all this information. setTextView(mApStr); } } }; 29 www.widbd.com
  • 30. User Interface Updating UI in code private void setTextView(String str) { TextView tv = (TextView) findViewById(R.id.textview); tv.setMovementMethod(new ScrollingMovementMethod()); tv.setText(str); } •This code simply has the UI display all collected WiFi APs, makes the text information scrollable UI Layout (XML) <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/button" android:text="@string/button_text"/> <TextView android:id="@+id/header" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/ap_list" tools:context=".WiFiActivity" android:textStyle="bold" android:gravity="center"> </TextView> <TextView android:layout_width="fill_parent" android:layout_height="fill_parent" tools:context=".WiFiActivity" android:id="@+id/textview" android:scrollbars="vertical"> </TextView> </LinearLayout> 30 www.widbd.com
  • 31. Android Programming Notes • Android apps have multiple points of entry: no main() method – Cannot “sleep” in Android – During each entrance, certain Objects may be null – Defensive programming is very useful to avoid crashes, e.g., if (!(myObj == null)) { // do something } • Java concurrency techniques are required – Don’t block the “main” thread in Activities – Implement long-running tasks such as network connections asynchronously, e.g., as AsyncTasks – Recommendation: read [4]; chapter 20 [10]; [11] • Logging state via android.util.Log throughout app is essential when debugging (finding root causes) • Better to have “too many” permissions than too few – Otherwise, app crashes due to security exceptions! – Remove “unnecessary” permissions before releasing app to public • Event handling in Android GUIs entails many listener Objects 31 www.widbd.com
  • 32. www.widbd.com References (1) 1. C. Horstmann, Big Java Late Objects, Wiley, 2012. Online: http://proquest.safaribooksonline. com.proxy.lib.ohio–state.edu/book/–/9781118087886 2. J. Bloch, Effective Java, 2nd ed., Addison–Wesley, 2008. Online: http://proquest. safaribooksonline.com.proxy.lib.ohio– state.edu/book/programming/java/9780137150021 3. S.B. Zakhour, S. Kannan, and R. Gallardo, The Java® Tutorial: A Short Course on the Basics, 5th ed., Addison–Wesley, 2013. Online: http://proquest.safaribooksonline.com.proxy.lib. ohio–state.edu/book/programming/java/9780132761987 4. C. Collins, M. Galpin, and M. Kaeppler, Android in Practice, Manning, 2011. Online: http://proquest.safaribooksonline.com.proxy.lib.ohio– state.edu/book/programming/android/9781935182924 5. M.L. Sichitiu, 2011, http://www.ece.ncsu.edu/wireless/MadeInWALAN/AndroidTutorial/PPTs/ javaReview.ppt 6. Oracle, http://docs.oracle.com/javase/1.5.0/docs/api/index.html 7. Wikipedia, https://en.wikipedia.org/wiki/Vehicle_Identification_Number 8. Nielsen Co., “Smartphone Milestone: Half of Mobile Subscribers Ages 55+ Own Smartphones”, 22 Apr. 2014, http://www.nielsen.com/us/en/insights/news/2014/ smartphone-milestone-half-of-americans-ages-55-own-smartphones.html 32
  • 36. www.widbd.com Game Here's a rundown of some of the best game creators for making PC, Android and iOS games. 1. GameSalad. ... 2. Stencyl. ... 3. GameMaker: Studio. ... 4. FlowLab. ... 5. Sploder. ... 6. ClickTeam Fusion 2.5. ... 7. Construct 2. 8. GameFroot.
  • 38. www.widbd.com Women in Digital Achievement (5 award) Spark International Award BRAC Manthan Award
  • 39. www.widbd.com Women in Digital Achievement Bangladesh Brand forum Award
  • 40. www.widbd.com Contact Women In Digital House 79, Road 3, Mohammadia Housing Limited ,Dhaka, Bangladesh Phone: +880-163-549-7868 Email: info@widbd.com , womenindigitalbd@gmail.com /WomeninDigital.net /wid_bd /widbd.Widbd.com womenindigital womenindigital womenindigital womenindigital