際際滷

際際滷Share a Scribd company logo
Introduction to Android Development
About Us
Kasun Delgolla
Software Engineer
WSO2
kasun.mck@gmail.com
Chathura Dilan
Senior Software Engineer
WSO2
dilan@dilan.me
Inosh Perera
Software Engineer
WSO2
inoshperera@gmail.com
Here's what we gonna discuss
 Introduction to Android OS and Android SDK
 Application Development in general
 Application types  Exploring Google Play
 Environment preparation (Android SDK tools)
 Technological overview - XML, Java etc
 Application framework
 Developing a simple Android app
 Monetization and Publishing process
Introduction to Android OS and Android SDK
 Android  A Linux based OS designed for touch screen mobile devices.
 It was initially developed by Android Inc, and later in 2005, Google bought
android.
 Android came into play in 2007 with the founding of OHA (Open Handset
Alliance) which is a consortium of 84 firms (Samsung, LG, Sony, HTC, Dell,
Intel, Motorola, Qualcomm, T-Mobile, Nvidia etc) to develop open standards for
mobile devices.
 The first Android-powered phone, T-Mobile G1 was sold in October 2008.
 Android is open source and Google releases the code under the Apache
License.
 Each major release is named in alphabetical order after a dessert or sugary
treat; for example, version 1.5 Cupcake was followed by 1.6 Donut.
Founders
Irina Blok
Android Versions
2015
Now...
 Android is the world's most popular mobile platform.
 It's powerful specially because of Google product support (Ex:
Searching, Navigation, G+, Play Store, You Tube, Drive,
Gmail,Calendar etc...)
 Multi-tasking
 Widgets
 Notifications
 Voice Typing and Actions
 Photos and videos
 High-end devices
Application Development in General
 We can define Android Application Development in 5 Stages
 Come up with a fantastic concept
 Design the App  Including a cool UI
 Develop the Application
 Publish on Google Play
 EARN :)
Application types  Exploring Google Play
 Within 600,000+ apps and games available on Google Play, we can find Apps which fall into
following categories
 Business
 Communication
 Entertainment
 Games
 Health and Fitness
 Media
 Lifestyle
 Books
 Finance
 News & Magazines
 Shopping
 Photography and many more...
Interface & Applications
 Android's user interface is based on direct manipulation, using touch inputs that loosely
correspond to real-world actions, like swiping, tapping, pinching and reverse pinching to
manipulate on-screen objects.
 Internal hardware such as accelerometers, gyroscopes and proximity sensors are used by
some applications to respond to additional user actions.
 Android devices boot to the homescreen, the primary navigation and information point on
the device, which is similar to the desktop found on PCs.
 Google offers the Google Play service in which programmers can offer their Android
application to Android users. Google phones include the Google Play application which
allows to install applications.
 There are more than 600,000 apps and games available on Google Play.
Android Framework
Let's get started :)
 Android SDK - Contains the necessary tools to create, compile and package Android application. It
also provides an Android device emulator and the Android debug bridge (adb) tool which allows to
connect to an virtual or real Android device.
 Android Development Tools (ADT) -
 Set of components (plug-ins) which comes packed with android studio/extend the
Eclipse IDE with Android development capabilities.
 It contains all required functionalities to create, compile, debug and deploy Android
applications from the Eclipse IDE.
 ADT also allows to create and start AVDs.
 Provides specialized editors for resources files, e.g. layout files. These editors
allow to switch between the XML representation of the file and a richer user
interface via tabs on the bottom of the editor.
 Dalvik Virtual Machine - The Android system uses a special virtual machine, i.e. the Dalvik Virtual
Machine to run Java based applications. Dalvik uses an own bytecode format which is different
from Java bytecode. Therefore you cannot directly run Java class files on Android, they need to get
converted in the Dalvik bytecode format.
How an APK is built
 Android applications are primarily written in the Java programming language.
 The Java source files are converted to Java class files by the Java compiler.
 The Android SDK contains a tool called dx which converts Java class files into a .dex (Dalvik Executable) file.
 All class files of one application are placed in one compressed .dex file.
 During this conversion process redundant information in the class files are optimized in the .dex file. For
example if the same String is found in different class files, the .dex file contains only once reference of this
String.
 The .dex file and the resources of an Android project, e.g. the images and XML files, are packed into an .apk
(Android Package) file. The program aapt (Android Asset Packaging Tool) performs this packaging.
 The resulting .apk file contains all necessary data to run the Android application and can be deployed to an
Android device via the adb tool.
Android Security Concept
 During deployment on an Android device, the Android system will create a
unique user and group ID for every Android application.
 Each Android application will be started in its own process.
 Every android application is isolated from other running applications.
 If data should be shared, application should do that explicitly (Using
content provider or services).
Android Permission Concept
 Android predefines permissions for certain tasks but every application can
define additional permissions.
 An Android application declare its required permissions in
its AndroidManifest.xml configuration file.
 In most cases the requested permissions will be presented to the user
before installation of the application. The user needs to decide if these
permissions are given to the application.
Application Components
 An Android application consists out of different Android components and
additional resources. Each type serves a distinct purpose and has a
distinct life-cycle that defines how the component is created and
destroyed.
 Activities
 Services
 Broadcast receiver
 Content provider
Activity Lifecycle
Find the device location
 LocationManager
 FusedLocationApi (Via GoogleAPIClient)
1. Import Google Play Services library
2. Update manifest with permissions and
Google play services meta tag
 Add code related to location API to your
activity.
1. Implement the class from ConnectionCallbacks, OnConnectionFailedListener.
2. Check for availability of Google Play Services by calling checkPlayServices() in
onResume().
3. Connect to Google API client by calling mGoogleApiClient.connect() in onStart()
method. By calling this, onConnectionFailed(), onConnected() and
onConnectionSuspended() will be triggered depending upon the connection status.
4. Once Google API is successfully connected, displayLocation() should be called
in onConnected() method to get the current location.
5. Make sure that the WIFI and location is enabled on your device before you test.
 If you need periodic location updates, you can
implement a LocationListener.
Getting Started with Android Development
What do you need?
 Computer
 JDK
 Android Studio
 Internet
 Android SDK tools
 Android Platform tools
 Android Build tools
 Idea?
Weather App (K辰lagune)
 GitHub: https://github.com/chaturadilan/Kalagune
 Download Images : http://bit.ly/1KZ8h1h
 Backend Service:
http://www.dilan.me/apps/weather/api.php
Resources
Android Activity
An activity is a single, focused thing that the user
can do. It is simply an user interface.
Activity Lifecycle
App Manifest
 Every application must have an
AndroidManifest.xml
 manifest file presents essential information
about your app to the Android system
Android Plug-in for Gradle
Gradle
 Advanced build toolkit that manages dependencies
 define custom build logic
 Uses Groovy Syntax
 Android Studio uses a Gradle wrapper
 Android plugin for Gradle also runs independent of
Android Studio
 The build configuration for your project is defined inside
build.gradle
Configuring Gradle Builds
Declare dependencies
dependencies {
// Module dependency
compile project(":lib")
// Remote binary dependency
compile 'com.android.support:appcompat-v7:19.0.1'
// Local binary dependency
compile fileTree(dir: 'libs', include: ['*.jar'])
}
Build variants
 Build variants are combinations of product flavors
and build types
 Product flavors represent product build versions of
an app, such as free and paid.
 Build types represent the build packaging versions
generated for each app package, such as debug
and release.
 The build system generates APKs for each
combination of product flavor and build type.
AppCompat
 Enables you to bring your latest designs to
older Android platforms
dependencies {
compile "com.android.support:appcompat-
v7:21.0.+"
}
Android Layouts
 Relative Layout - Enables you to specify the
location of child objects relative to each other

 Linear Layout - A layout that organizes its
children into a single horizontal or vertical row.
Home Activity Views
 Time - id = textViewTime, size = 36sp
 Date - id = textViewDate, size = 18sp
 Image - id = imageViewWeather, height/width= 200dp
 Weather - id = textViewWeather, size = 18sp
 Temp - id = textViewTemp, size = 64sp
 City - id = textViewCity, size = 36sp
Screen Densities
 ldpi (low) ~120dpi
 mdpi (medium) ~160dpi
 hdpi (high) ~240dpi
 xhdpi (extra-high) ~320dpi
 xxhdpi (extra-extra-high) ~480dpi
 xxxhdpi (extra-extra-extra-high) ~640dpi
Range of screens supported
xlarge screens are at least 960dp x 720dp
large screens are at least 640dp x 480dp
normal screens are at least 470dp x 320dp
small screens are at least 426dp x 320dp
Multiple Layouts Files
 res/layout/main_activity.xml
# For handsets (smaller than 600dp available width)
 res/layout-sw600dp/main_activity.xml
# For 7 tablets (600dp wide and bigger)
 res/layout-sw720dp/main_activity.xml
# For 10 tablets (720dp wide and bigger)
Fragments
 A Fragment represents a behavior or a portion
of user interface in an Activity
 Fragments has it's own life cycles
 A fragment must always be embedded in an
activity
Adapter
 The Adapter provides access to the data items.
 Adapter is also responsible for making a View
for each item in the data set
Checking out the source from
Github
 https://github.com/chaturadilan/Kalagune
Monetization of Applications
 Google Admob
 Dialog In-App Purchase Android SDK
Monetize without Compromising User Experience
w
Preparing Application for Release
 keytool -genkey -v -keystore
<filename>.keystore -alias <key-name> -keyalg
RSA -keysize 2048 -validity 10000
Publishing Android app in Google
Play
 A developer account must be created. $25
 All applications need to be signed with a
cryptographic key that expires after October 22,
2033.
 Maximum size for an APK published on Google
Play is 50MB or use APK Expansions
Google Play Developer Console
Upload new apk
Upload Assets
Resources
 http://www.androidhive.info/2015/02/android-locatio
 http://developer.android.com/training/index.html
 http://www.vogella.com/android.html
 http://www.tutorialspoint.com/android/
Thank you!

More Related Content

What's hot (20)

Get an Android tutorial for beginners
Get an Android tutorial for beginnersGet an Android tutorial for beginners
Get an Android tutorial for beginners
JavaTpoint.Com
Android Programming
Android ProgrammingAndroid Programming
Android Programming
Pasi Manninen
Android App Development Intro at ESC SV 2012
Android App Development Intro at ESC SV 2012Android App Development Intro at ESC SV 2012
Android App Development Intro at ESC SV 2012
Opersys inc.
Intro To Android App Development
Intro To Android App DevelopmentIntro To Android App Development
Intro To Android App Development
Mike Kvintus
Android Programming made easy
Android Programming made easyAndroid Programming made easy
Android Programming made easy
Lars Vogel
Android Programming Seminar
Android Programming SeminarAndroid Programming Seminar
Android Programming Seminar
Nhat Nguyen
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
master760
Introduction to Android development - Presentation Report
Introduction to Android development - Presentation ReportIntroduction to Android development - Presentation Report
Introduction to Android development - Presentation Report
Atul Panjwani
Android architecture
Android architectureAndroid architecture
Android architecture
Hari Krishna
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
zeelpatel0504
Introduction to Android, Architecture & Components
Introduction to  Android, Architecture & ComponentsIntroduction to  Android, Architecture & Components
Introduction to Android, Architecture & Components
Vijay Rastogi
Android basics
Android basicsAndroid basics
Android basics
Syed Luqman Quadri
Android terminologies
Android terminologiesAndroid terminologies
Android terminologies
jerry vasoya
Android Web app
Android Web app Android Web app
Android Web app
Sumit Kumar
Android basics
Android basicsAndroid basics
Android basics
Berglind sk Bergsd坦ttir
Ci for Android
Ci for AndroidCi for Android
Ci for Android
Alexey Ustenko
An introduction to Android
An introduction to AndroidAn introduction to Android
An introduction to Android
Rajesh Jambukia
Android development - the basics, MFF UK, 2014
Android development - the basics, MFF UK, 2014Android development - the basics, MFF UK, 2014
Android development - the basics, MFF UK, 2014
Tom叩邸 Kypta
Generating efficient APK by Reducing Size and Improving Performance
Generating efficient APK by Reducing Size and Improving PerformanceGenerating efficient APK by Reducing Size and Improving Performance
Generating efficient APK by Reducing Size and Improving Performance
Paresh Mayani
Android Presentation
Android PresentationAndroid Presentation
Android Presentation
Bram Vandeputte
Get an Android tutorial for beginners
Get an Android tutorial for beginnersGet an Android tutorial for beginners
Get an Android tutorial for beginners
JavaTpoint.Com
Android Programming
Android ProgrammingAndroid Programming
Android Programming
Pasi Manninen
Android App Development Intro at ESC SV 2012
Android App Development Intro at ESC SV 2012Android App Development Intro at ESC SV 2012
Android App Development Intro at ESC SV 2012
Opersys inc.
Intro To Android App Development
Intro To Android App DevelopmentIntro To Android App Development
Intro To Android App Development
Mike Kvintus
Android Programming made easy
Android Programming made easyAndroid Programming made easy
Android Programming made easy
Lars Vogel
Android Programming Seminar
Android Programming SeminarAndroid Programming Seminar
Android Programming Seminar
Nhat Nguyen
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
master760
Introduction to Android development - Presentation Report
Introduction to Android development - Presentation ReportIntroduction to Android development - Presentation Report
Introduction to Android development - Presentation Report
Atul Panjwani
Android architecture
Android architectureAndroid architecture
Android architecture
Hari Krishna
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
zeelpatel0504
Introduction to Android, Architecture & Components
Introduction to  Android, Architecture & ComponentsIntroduction to  Android, Architecture & Components
Introduction to Android, Architecture & Components
Vijay Rastogi
Android terminologies
Android terminologiesAndroid terminologies
Android terminologies
jerry vasoya
Android Web app
Android Web app Android Web app
Android Web app
Sumit Kumar
An introduction to Android
An introduction to AndroidAn introduction to Android
An introduction to Android
Rajesh Jambukia
Android development - the basics, MFF UK, 2014
Android development - the basics, MFF UK, 2014Android development - the basics, MFF UK, 2014
Android development - the basics, MFF UK, 2014
Tom叩邸 Kypta
Generating efficient APK by Reducing Size and Improving Performance
Generating efficient APK by Reducing Size and Improving PerformanceGenerating efficient APK by Reducing Size and Improving Performance
Generating efficient APK by Reducing Size and Improving Performance
Paresh Mayani

Similar to Java Meetup - 12-03-15 - Android Development Workshop (20)

Seminar on android app development
Seminar on android app developmentSeminar on android app development
Seminar on android app development
AbhishekKumar4779
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
lzongren
Android session 1
Android session 1Android session 1
Android session 1
Ahesanali Suthar
Mobile application development
Mobile application developmentMobile application development
Mobile application development
umesh patil
Notes Unit2.pptx
Notes Unit2.pptxNotes Unit2.pptx
Notes Unit2.pptx
MIT Autonomous Aurangabad
Getting started with android programming
Getting started with android programmingGetting started with android programming
Getting started with android programming
PERKYTORIALS
Android Development in a Nutshell
Android Development in a NutshellAndroid Development in a Nutshell
Android Development in a Nutshell
Aleix Sol辿
Developing for Android-Types of Android Application
Developing for Android-Types of Android ApplicationDeveloping for Android-Types of Android Application
Developing for Android-Types of Android Application
Nandini Prabhu
Android Development
Android DevelopmentAndroid Development
Android Development
John Mark 吾с潟若
Android by LAlitha
Android by LAlithaAndroid by LAlitha
Android by LAlitha
Lally Lalitha
Android deep dive
Android deep diveAndroid deep dive
Android deep dive
AnuSahniNCI
Android app development.pdf
Android app development.pdfAndroid app development.pdf
Android app development.pdf
Abanti Aazmin
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
fantasy zheng
Android app development ppt
Android app development pptAndroid app development ppt
Android app development ppt
saitej15
Os eclipse-androidwidget-pdf
Os eclipse-androidwidget-pdfOs eclipse-androidwidget-pdf
Os eclipse-androidwidget-pdf
weerabahu
20IT601PE - Mobile Application Development PPT.pdf
20IT601PE - Mobile Application Development PPT.pdf20IT601PE - Mobile Application Development PPT.pdf
20IT601PE - Mobile Application Development PPT.pdf
vani15332
Introduction_to_android_and_android_studio
Introduction_to_android_and_android_studioIntroduction_to_android_and_android_studio
Introduction_to_android_and_android_studio
Abdul Basit
Creating the first app with android studio
Creating the first app with android studioCreating the first app with android studio
Creating the first app with android studio
Parinita03
Unit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-assUnit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-ass
ARVIND SARDAR
Mobile Application Development-Lecture 03 & 04.pdf
Mobile Application Development-Lecture 03 & 04.pdfMobile Application Development-Lecture 03 & 04.pdf
Mobile Application Development-Lecture 03 & 04.pdf
AbdullahMunir32
Seminar on android app development
Seminar on android app developmentSeminar on android app development
Seminar on android app development
AbhishekKumar4779
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
lzongren
Mobile application development
Mobile application developmentMobile application development
Mobile application development
umesh patil
Getting started with android programming
Getting started with android programmingGetting started with android programming
Getting started with android programming
PERKYTORIALS
Android Development in a Nutshell
Android Development in a NutshellAndroid Development in a Nutshell
Android Development in a Nutshell
Aleix Sol辿
Developing for Android-Types of Android Application
Developing for Android-Types of Android ApplicationDeveloping for Android-Types of Android Application
Developing for Android-Types of Android Application
Nandini Prabhu
Android by LAlitha
Android by LAlithaAndroid by LAlitha
Android by LAlitha
Lally Lalitha
Android deep dive
Android deep diveAndroid deep dive
Android deep dive
AnuSahniNCI
Android app development.pdf
Android app development.pdfAndroid app development.pdf
Android app development.pdf
Abanti Aazmin
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
fantasy zheng
Android app development ppt
Android app development pptAndroid app development ppt
Android app development ppt
saitej15
Os eclipse-androidwidget-pdf
Os eclipse-androidwidget-pdfOs eclipse-androidwidget-pdf
Os eclipse-androidwidget-pdf
weerabahu
20IT601PE - Mobile Application Development PPT.pdf
20IT601PE - Mobile Application Development PPT.pdf20IT601PE - Mobile Application Development PPT.pdf
20IT601PE - Mobile Application Development PPT.pdf
vani15332
Introduction_to_android_and_android_studio
Introduction_to_android_and_android_studioIntroduction_to_android_and_android_studio
Introduction_to_android_and_android_studio
Abdul Basit
Creating the first app with android studio
Creating the first app with android studioCreating the first app with android studio
Creating the first app with android studio
Parinita03
Unit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-assUnit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-ass
ARVIND SARDAR
Mobile Application Development-Lecture 03 & 04.pdf
Mobile Application Development-Lecture 03 & 04.pdfMobile Application Development-Lecture 03 & 04.pdf
Mobile Application Development-Lecture 03 & 04.pdf
AbdullahMunir32

Java Meetup - 12-03-15 - Android Development Workshop

  • 2. About Us Kasun Delgolla Software Engineer WSO2 kasun.mck@gmail.com Chathura Dilan Senior Software Engineer WSO2 dilan@dilan.me Inosh Perera Software Engineer WSO2 inoshperera@gmail.com
  • 3. Here's what we gonna discuss Introduction to Android OS and Android SDK Application Development in general Application types Exploring Google Play Environment preparation (Android SDK tools) Technological overview - XML, Java etc Application framework Developing a simple Android app Monetization and Publishing process
  • 4. Introduction to Android OS and Android SDK Android A Linux based OS designed for touch screen mobile devices. It was initially developed by Android Inc, and later in 2005, Google bought android. Android came into play in 2007 with the founding of OHA (Open Handset Alliance) which is a consortium of 84 firms (Samsung, LG, Sony, HTC, Dell, Intel, Motorola, Qualcomm, T-Mobile, Nvidia etc) to develop open standards for mobile devices. The first Android-powered phone, T-Mobile G1 was sold in October 2008. Android is open source and Google releases the code under the Apache License. Each major release is named in alphabetical order after a dessert or sugary treat; for example, version 1.5 Cupcake was followed by 1.6 Donut.
  • 7. Now... Android is the world's most popular mobile platform. It's powerful specially because of Google product support (Ex: Searching, Navigation, G+, Play Store, You Tube, Drive, Gmail,Calendar etc...) Multi-tasking Widgets Notifications Voice Typing and Actions Photos and videos High-end devices
  • 8. Application Development in General We can define Android Application Development in 5 Stages Come up with a fantastic concept Design the App Including a cool UI Develop the Application Publish on Google Play EARN :)
  • 9. Application types Exploring Google Play Within 600,000+ apps and games available on Google Play, we can find Apps which fall into following categories Business Communication Entertainment Games Health and Fitness Media Lifestyle Books Finance News & Magazines Shopping Photography and many more...
  • 10. Interface & Applications Android's user interface is based on direct manipulation, using touch inputs that loosely correspond to real-world actions, like swiping, tapping, pinching and reverse pinching to manipulate on-screen objects. Internal hardware such as accelerometers, gyroscopes and proximity sensors are used by some applications to respond to additional user actions. Android devices boot to the homescreen, the primary navigation and information point on the device, which is similar to the desktop found on PCs. Google offers the Google Play service in which programmers can offer their Android application to Android users. Google phones include the Google Play application which allows to install applications. There are more than 600,000 apps and games available on Google Play.
  • 12. Let's get started :) Android SDK - Contains the necessary tools to create, compile and package Android application. It also provides an Android device emulator and the Android debug bridge (adb) tool which allows to connect to an virtual or real Android device. Android Development Tools (ADT) - Set of components (plug-ins) which comes packed with android studio/extend the Eclipse IDE with Android development capabilities. It contains all required functionalities to create, compile, debug and deploy Android applications from the Eclipse IDE. ADT also allows to create and start AVDs. Provides specialized editors for resources files, e.g. layout files. These editors allow to switch between the XML representation of the file and a richer user interface via tabs on the bottom of the editor. Dalvik Virtual Machine - The Android system uses a special virtual machine, i.e. the Dalvik Virtual Machine to run Java based applications. Dalvik uses an own bytecode format which is different from Java bytecode. Therefore you cannot directly run Java class files on Android, they need to get converted in the Dalvik bytecode format.
  • 13. How an APK is built Android applications are primarily written in the Java programming language. The Java source files are converted to Java class files by the Java compiler. The Android SDK contains a tool called dx which converts Java class files into a .dex (Dalvik Executable) file. All class files of one application are placed in one compressed .dex file. During this conversion process redundant information in the class files are optimized in the .dex file. For example if the same String is found in different class files, the .dex file contains only once reference of this String. The .dex file and the resources of an Android project, e.g. the images and XML files, are packed into an .apk (Android Package) file. The program aapt (Android Asset Packaging Tool) performs this packaging. The resulting .apk file contains all necessary data to run the Android application and can be deployed to an Android device via the adb tool.
  • 14. Android Security Concept During deployment on an Android device, the Android system will create a unique user and group ID for every Android application. Each Android application will be started in its own process. Every android application is isolated from other running applications. If data should be shared, application should do that explicitly (Using content provider or services).
  • 15. Android Permission Concept Android predefines permissions for certain tasks but every application can define additional permissions. An Android application declare its required permissions in its AndroidManifest.xml configuration file. In most cases the requested permissions will be presented to the user before installation of the application. The user needs to decide if these permissions are given to the application.
  • 16. Application Components An Android application consists out of different Android components and additional resources. Each type serves a distinct purpose and has a distinct life-cycle that defines how the component is created and destroyed. Activities Services Broadcast receiver Content provider
  • 18. Find the device location LocationManager FusedLocationApi (Via GoogleAPIClient)
  • 19. 1. Import Google Play Services library 2. Update manifest with permissions and Google play services meta tag
  • 20. Add code related to location API to your activity. 1. Implement the class from ConnectionCallbacks, OnConnectionFailedListener. 2. Check for availability of Google Play Services by calling checkPlayServices() in onResume(). 3. Connect to Google API client by calling mGoogleApiClient.connect() in onStart() method. By calling this, onConnectionFailed(), onConnected() and onConnectionSuspended() will be triggered depending upon the connection status. 4. Once Google API is successfully connected, displayLocation() should be called in onConnected() method to get the current location. 5. Make sure that the WIFI and location is enabled on your device before you test. If you need periodic location updates, you can implement a LocationListener.
  • 21. Getting Started with Android Development
  • 22. What do you need? Computer JDK Android Studio Internet Android SDK tools Android Platform tools Android Build tools Idea?
  • 24. GitHub: https://github.com/chaturadilan/Kalagune Download Images : http://bit.ly/1KZ8h1h Backend Service: http://www.dilan.me/apps/weather/api.php Resources
  • 25. Android Activity An activity is a single, focused thing that the user can do. It is simply an user interface.
  • 27. App Manifest Every application must have an AndroidManifest.xml manifest file presents essential information about your app to the Android system
  • 29. Gradle Advanced build toolkit that manages dependencies define custom build logic Uses Groovy Syntax Android Studio uses a Gradle wrapper Android plugin for Gradle also runs independent of Android Studio The build configuration for your project is defined inside build.gradle
  • 31. Declare dependencies dependencies { // Module dependency compile project(":lib") // Remote binary dependency compile 'com.android.support:appcompat-v7:19.0.1' // Local binary dependency compile fileTree(dir: 'libs', include: ['*.jar']) }
  • 32. Build variants Build variants are combinations of product flavors and build types Product flavors represent product build versions of an app, such as free and paid. Build types represent the build packaging versions generated for each app package, such as debug and release. The build system generates APKs for each combination of product flavor and build type.
  • 33. AppCompat Enables you to bring your latest designs to older Android platforms dependencies { compile "com.android.support:appcompat- v7:21.0.+" }
  • 34. Android Layouts Relative Layout - Enables you to specify the location of child objects relative to each other Linear Layout - A layout that organizes its children into a single horizontal or vertical row.
  • 35. Home Activity Views Time - id = textViewTime, size = 36sp Date - id = textViewDate, size = 18sp Image - id = imageViewWeather, height/width= 200dp Weather - id = textViewWeather, size = 18sp Temp - id = textViewTemp, size = 64sp City - id = textViewCity, size = 36sp
  • 36. Screen Densities ldpi (low) ~120dpi mdpi (medium) ~160dpi hdpi (high) ~240dpi xhdpi (extra-high) ~320dpi xxhdpi (extra-extra-high) ~480dpi xxxhdpi (extra-extra-extra-high) ~640dpi
  • 37. Range of screens supported xlarge screens are at least 960dp x 720dp large screens are at least 640dp x 480dp normal screens are at least 470dp x 320dp small screens are at least 426dp x 320dp
  • 38. Multiple Layouts Files res/layout/main_activity.xml # For handsets (smaller than 600dp available width) res/layout-sw600dp/main_activity.xml # For 7 tablets (600dp wide and bigger) res/layout-sw720dp/main_activity.xml # For 10 tablets (720dp wide and bigger)
  • 39. Fragments A Fragment represents a behavior or a portion of user interface in an Activity Fragments has it's own life cycles A fragment must always be embedded in an activity
  • 40. Adapter The Adapter provides access to the data items. Adapter is also responsible for making a View for each item in the data set
  • 41. Checking out the source from Github https://github.com/chaturadilan/Kalagune
  • 42. Monetization of Applications Google Admob Dialog In-App Purchase Android SDK
  • 43. Monetize without Compromising User Experience w
  • 44. Preparing Application for Release keytool -genkey -v -keystore <filename>.keystore -alias <key-name> -keyalg RSA -keysize 2048 -validity 10000
  • 45. Publishing Android app in Google Play A developer account must be created. $25 All applications need to be signed with a cryptographic key that expires after October 22, 2033. Maximum size for an APK published on Google Play is 50MB or use APK Expansions
  • 49. Resources http://www.androidhive.info/2015/02/android-locatio http://developer.android.com/training/index.html http://www.vogella.com/android.html http://www.tutorialspoint.com/android/