3. Why Motivation?
Motivation drives your growth
Specifically “Self Motivation”
Beneficiaries – You and your organization
Today’s Motivation – Android
4. What is Android?
It is not an Operating System….
An open source software stack build on top of Linux
Language – Java
Provides an infrastructure for advanced applications.
Helps developers use that infrastructure for apps
5. Android Development
Third party app development
Our agenda
Ability to monetize apps
http://developer.android.com
Native Platform development
Mobile Phone makers (HTC, Samsung, Motorola)
Genuine geeks
Cannot monetize
http://source.android.com
7. Simulator and Emulator
Simulator
A system designed only to test your software
Flight Simulator
Space Simulator
Obviously you cannot fly
Emulator
Test your target architecture on another computer
Copy the real hardware and software into another
computer
Android Emulator
8. What will you learn today?
SDK Setup
Hello World Application
Adding more concepts to the application
Practical correlation of Android concepts
Writing a Location based application
Device Management
9. Agenda
Hello World Application
Application Components
Concepts
Activity
Service
App Storage
Broadcast Receivers
Android Permissions
Location and Maps
Debugging
Device Management
14. Android Activity
Anything that the application does
A UI window containing various
views (Button, TextView, Label etc) –
Similar to Java Swings
View elements may listen for user
actions
An application can have various
activities
One can start another (Opening one
window from another window) –
Using startActivity(intent)
15. Launcher Activity
The activity that shows up when the app is launched
Manifest changes
<activity android:name=".ExampleActivity"
android:icon="@drawable/app_icon">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
18. Lets try it out!!!
Create an app
Check the Manifest for Launcher Activity
Create a Sub Activity and launch it from the main activity
Return the sub activity result to the main activity
Add some UI elements
Activity Lifecycle example – Google provided
19. Services
To run in background & no UI
Types - Started Services, Bound Services
Started Services
Owned by the application
Typically started by an activity
Bound Services
Owned by the application
Shared by others – Binder
20. Invoking a Service
startService()
Code to start a service
Intent intent = new Intent(this, HelloService.class);
startService(intent);
onStartCommand()
bindService()
onBind()
Requires an Intent action/Service class name
21. Started Service
Intent Service
Offloads to a Worker Thread
Provides a Work Queue
Stops the service once work is done
Less code
Normal Service
Manually create background thread
Multi threaded work
More code
23. Lets try it out!!!
Create three Services
Intent Service – One at a time
Normal Service – One at a time
Normal Service – Multi Request
Bound Service (If time permits)
Use an Activity to launch the service
Update Manifest with the service declarations
24. Application Storage
Shared Preferences
User’s settings
Key-Value Pairs
Internal Storage
App’s private data
Cannot be accessed by other apps
External Storage
Public data
Typically sdcard
27. Lets try it out !!!
Create a content provider step by step
SQLiteOpenHelper instance
SQLiteDatabase instance
Implement CRUD methods
Store student name and percentage
Show the saved data
28. Listeners & Broadcast Receivers
Hey Friend! Inform us when the results are out!!
Above statement – Registration
You – Listener
Your Friend – Broadcaster
“When the results are out” – Intent
29. Listeners & Broadcast Receivers
Register for event notifications
Signal Change Notification
On boot complete Notification
Battery Notification
Location Change Notification
Etc…
Communicate results from one app to other/others
30. Listeners & Broadcast Receivers
Registration
Permanent
Register in Manifest
Example: onBootComplete
On/Off
Register/Unregister when required
Example: Location Change Notification
31. Lets try it out !!!
Create an application that will show Signal changes
Let the application be launched on Boot
Register/UnRegister signal changes
32. Intent & Intent Filter
Intent – The intention behind doing something
Used in Services example to pass data.
Intent Filter – What are my intentions?
Used in Broadcast receivers to specify what to listen to.
33. Android Permissions
Declared in Manifest
Required if your app uses Android sensitive infrastructure
Read/Write contacts
Read Network State
Read/Write External Storage (App Storage)
OnBootComplete
Etc…
34. More Concepts
More UI Concepts
Alert Dialogs
Date, Time dialogs
ANR
Pick Contacts
Notification/Toasts
Location, Maps Activity
Usage of Broadcast Receivers
Use Google APIs in Android
Device Management
Need for Securing Mobile Devices
35. UI Concepts
Dialogs
Alerts the user for info or some input
ANR – Application Not Responding
Drives the developer crazy
Never run long running tasks in UI Thread
Remember – LoaderCallbacks<CursorLoader>?
Lets try out a sample showing all the above PLUS
How to launch Contacts app
36. Location and Maps
Google APIs (MapActivity)
Obtain Maps API Key
Require Internet Permission
Maps add Overlay Items
Location Information – GPS/Network
37. Lets try it out!!!
Write a MapActivity
Register for Location from GPS/Network
Place that location onto the Map as a OverlayItem
Point using a Marker – A Pin
Permission Requirements for the App
39. Lost your device?
Remotely Lock your device
Install Apps such as Lookout
Try to get the location after losing
Configure alternate numbers in Lookout
Get SMS when the SIM card is changed
More chances of getting the device back
41. Benefits of learning Android
Massive market share (50 to 60%) of global smartphone
share.
Samsung, Motorola, Sony, LG, HTC are major players
Play Store – 500000+ apps
Get a fundoo job
Monetize your application
42. JOB !!!
Show your marks and answer simple Questions
Learn Android + One app in PlayStore
Data Structures + Algorithms + 1 Mobile Platform
43. JOB !!!
Show your marks and answer simple Questions – Service
Companies - Infosys, Wipro, HCL, CTS, TCS etc…
Android – Good Product Companies – Zomato, Zynga,
SAP, Ericsson
Data Structures + Algorithms + 1 Mobile Platform –
Premium Product Companies
Google, Yahoo, Microsoft, Akamai
44. JOB !!!
Service Companies – 2.5 to 3.5
Product Companies – 4.0 to 5.5
Premium Product Companies – 7 to 12
45. What Now !!!
Pick up Android SDK and use the developer link to kick
start
Develop small apps and relish
Find an idea, develop it and put it in playstore.
25$ to put in PlayStore
I have an account – You can use it free
Get back to me with your questions
Android Help??
Project Help??