[2024]Digital Global Overview Report 2024 Meltwater.pdf
Android TCJUG
1.
2. Summary
About Me
What is Android
Anatomy of Android
Setting up the environment
Let's Code! quot;Contractoidquot;
Deploy to the Market
3. About Me
Name: Justin Grammens
Owner Localtone Interactive - http://www.localtone.com
Focus on mobile, internet and voice applications
Support and advocate for open formats (ogg, odf)
Background in Java
Working in Ruby/Rails/Grails on/off for the past 2 years
Enjoy working in new technologies
VoIP
Asterisk
Adhearsion
Mobile
Android
iPhone
Started MobileTC - http://mobiletwincities.com
4. What is Android?
Definition:
Android is a software platform and operating system
for mobile devices, based on the Linux kernel,
developed by Google and later the Open Handset
Alliance.
Source: Wikipedia
It's not just for mobile devices. Has the potential to
be used in all sorts of other areas where memory,
cpu and disk is limited.
6. What is Android?
A Project of the Open Handset Alliance (OHA)
- More than 30 technology companies
Source: Presentation by Sean Sullivan - http://mobileportland.com/content/introduction-google-android
7. Anatomy of Android
Built on the Linux kernel
Uses the Dalvik virtual machine
Register Based VM written by Dan Bornstein
Very low memory footprint
Core and 3rd party applications have equal access
Multiple applications able to run at the same time
Copy and Paste functionality
Background services
Able to embed HTML, Javascript and stylesheets
100% fully customizable
Handles native and streaming playback of mutimedia
Currently supports developing apps in Java
8. What's the big deal?
Truly open and FREE development platform.
No quot;pay to playquot; developer agreement.
Freely available tools (Eclipse) and no restrictions on OS
you need to be on to develop.
Component based architecture that can be extended
Built in services out of the box.
Location based (Gmail, Maps, Contacts)
Multimedia - supports OGG!
SQLite Database.
Automatic management of application lifecycle.
Portability across current and future hardware.
Supports and plans for input from either trackball,
keyboard or touch.
Write your apps using Java!
10. Anatomy of Android
Basic foundation of an Android application
Activity
Intent
Service
Content Provider
Your applications will not use all of these, but
they will use atleast one.
11. Anatomy of Android
Activity
Describes a single screen of the application
Implemented as a class that extends Activity
Activities are pushed on the history stack using an
Intent
Uses callbacks to trigger events during state changes.
public class LocaltoneAndroid extends ListActivity {
@Override
public void onCreate(Bundle init) {
}
}
13. Anatomy of Android
Intent
An Intent describes what you would like to have done.
Create new screen using activity and intents
Intent i = new Intent(this, MyNewActivity.class);
startActivity(i);
or open a web page
new Intent(android.content.Intent.VIEW_ACTION,
ContentURI.create(quot;http://localtone.comquot;));
14. Anatomy of Android
Service
Code that is long running
Runs without a UI
Media Player is an good example
Activity used to choose song
Playback handled in a service
public class MyService extends Service {
public void onCreate() {
}
}
15. Anatomy of Android
Content Provider
Set of data wrapped in a custom API
Allow sharing of data between applications
Processes register themselves as a Content Provider.
Anyone can share data. Google shares contacts, address,
phone, etc. can be accessed by applications.
private String[]
cols={android.provider.Contacts.PeopleColumns.NAME};
private Cursor cur =
managedQuery(android.provider.Contacts.People.CONTENT_URI,
cols, null, null);
http://developer.android.com/reference/android/provider/package-summary.html
16. Anatomy of Android
Various types of Layouts - Similar to Java Swing
Linear Layout
Arranges children in a single row/column. The most
common type of layout you'll use.
FrameLayout
Arranges children so they start at the top left. Used
mainly for tabbed views.
Relative Layout
Arranged in relation to eachother ( element X is
above/below element Y for example ).
TableLayout
Arranged in a cells, like HTML table.
18. Anatomy of Android
Declarative - In XML
Task: Define text in an quot;Aboutquot; screen
File: res/layout/about.xml
<TextView android:id=quot;@+id/about_contentquot;
android:layout_width=quot;wrap_contentquot;
android:layout_height=quot;wrap_contentquot;
android:text=quot;@string/about_textquot; />
File: About.java
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.about);
}
19. Anatomy of Android
Procedural - In Code
Create a TextView object, set the text and behavior
TextView pressMe = new TextView(context);
pressMe.setText(quot;Press Mequot;);
addView(mDialogue, new LinearLayout.LayoutParams(
FILL_PARENT, WRAP_CONTENT));
20. Anatomy of Android
Android Manifest.xml
What is any good Java program without a manifest file? =)
Defines the version and package information
Defines the permissions required by the application
<uses-permission android:name=quot;android.
permission.INTERNETquot; />
<activity android:name=quot;.Resultquot; Class name
android:label=quot;@string/resultquot; of the Activity
android:layout_width=quot;fill_parentquot;>
</activity>
21. Development Environment
Develop using Windows, Linux or Mac.
Free to develop and deploy to your device.
Recommend using to Eclipse IDE and Android Plugin
Download IDE and from
IDE - http://eclipse.org
Install Android plugin through the Eclipse Plug-in
Manager
SDK
http://code.google.com/android/intro/installing.html
24. Resources
Books
Hello, Android by Pragmatic Programmers
Free PDF by AndDev.org - http://href.to/AB1
Sites
AndDev.org - Good online forum
Google Samples - http://is.gd/knVZ
IRC
#Android-Dev
Google Groups
Android Developers
http://is.gd/knWK
Local Groups!
Android Dev MN - http://is.gd/knVO
Mobile Twin Cities - http://mobiletwincities.com
25. Let's Code!
Source code of
Contractoid at:
http://github.
com/justingrammens/contract
oid/tree/master
or at:
http://is.gd/TZFP
Video of this presentation
at:
http://is.gd/U4Zr