Your SlideShare is downloading. ×
0
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Android basic principles
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Android basic principles

6,284

Published on

Published in: Technology
1 Comment
8 Likes
Statistics
Notes
  • i need more detail about steganography

    can any one help..?
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
6,284
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
1
Likes
8
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Android<br /> Architecture<br />
  • 2. Agenda <br />The Virtual Machine<br />The stack<br />Android application (Part 1)<br />Android application (Part 2, next time)<br />Overview Presentation<br />2<br />
  • 3. The Virtual Machine<br />Overview Presentation<br />3<br />
  • 4. The stack<br />Overview Presentation<br />4<br />
  • 5. The stack II<br />Overview Presentation<br />5<br />Android is a layered environment built upon a foundation of Linux kernel. Android applications are written in Java programming language and they run in Dalvik Virtual Machine, an open source technology. Each Android application runs within an instance of the Dalvik VM, which in turn resides within a Linux-kernel managed process<br />
  • 6. The stack III<br />Overview Presentation<br />6<br />Android platform layers:<br />
  • 7. The stack IV<br />Overview Presentation<br />7<br />In more detail:<br />
  • 8. Application framework<br />Overview Presentation<br />8<br />Developers have full access to the same framework APIs used by the core applications. The application architecture is designed to simplify the reuse of components; any application can publish its capabilities and any other application may then make use of those capabilities (subject to security constraints enforced by the framework). This same mechanism allows components to be replaced by the user.<br />Underlying all applications is a set of services and systems, including:<br />A rich and extensible set of Views that can be used to build an application, including lists, grids, text boxes, buttons, and even an embeddable web browser<br />Content Providers that enable applications to access data from other applications (such as Contacts), or to share their own data <br />A Resource Manager, providing access to non-code resources such as localized strings, graphics, and layout files<br />A Notification Manager that enables all applications to display custom alerts in the status bar<br />An Activity Manager that manages the lifecycle of applications and provides a common navigation backstack<br />
  • 9. Libraries<br />System C library - a BSD-derived implementation of the standard C system library (libc), tuned for embedded Linux-based devices<br />Media Libraries - based on PacketVideo'sOpenCORE; the libraries support playback and recording of many popular audio and video formats, as well as static image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG<br />Surface Manager - manages access to the display subsystem and seamlessly composites 2D and 3D graphic layers from multiple applications<br />LibWebCore - a modern web browser engine which powers both the Android browser and an embeddable web view<br />SGL - the underlying 2D graphics engine<br />3D libraries - an implementation based on OpenGL ES 1.0 APIs; the libraries use either hardware 3D acceleration (where available) or the included, highly optimized 3D software rasterizer<br />FreeType - bitmap and vector font rendering<br />SQLite - a powerful and lightweight relational database engine available to all applications<br />Overview Presentation<br />9<br />Android includes a set of C/C++ libraries used by various components of the Android system. These capabilities are exposed to developers through the Android application framework. Some of the core libraries are listed below:<br />
  • 10. What are the main components of a Android application<br />Part I, today<br />Short introduction in Eclipse<br />AndroidManifest.xml<br />Activity<br />Intents<br />Application resources<br />Layouts<br />Localization<br />Part II, next time<br />Application preferences<br />App Widgets<br />Services<br />broadcast receivers<br />content providers<br />Overview Presentation<br />10<br />
  • 11. What are the main components of a Android application<br />Part I, today<br />Short introduction in Eclipse<br />AndroidManifest.xml<br />Activity<br />Intents<br />Application resources<br />Layouts<br />Localization<br />Part II, next time<br />Application preferences<br />App Widgets<br />Services<br />broadcast receivers<br />content providers<br />Overview Presentation<br />11<br />
  • 12. Demo development envirioment<br />Overview Presentation<br />12<br />
  • 13. What are the main components of a Android application<br />Part I, today<br />Short introduction in Eclipse<br />AndroidManifest.xml<br />Activity<br />Intents<br />Application resources<br />Layouts<br />Localization<br />Part II, next time<br />Application preferences<br />App Widgets<br />Services<br />broadcast receivers<br />content providers<br />Overview Presentation<br />13<br />
  • 14. The AndroidManifest.xml File<br />Overview Presentation<br />14<br />Every application must have an AndroidManifest.xml file (with precisely that name) in its root directory. The manifest presents essential information about the application to the Android system, information the system must have before it can run any of the application's code. <br />It names the Java package for the application. The package name serves as a unique identifier for the application.<br />
  • 15. The AndroidManifest.xml File<br />It describes the components of the application — the activities, services, broadcast receivers, and content providers that the application is composed of. It names the classes that implement each of the components and publishes their capabilities (for example, which Intent messages they can handle). These declarations let the Android system know what the components are and under what conditions they can be launched.<br />It declares which permissions the application must have in order to access protected parts of the API and interact with other applications.<br />Overview Presentation<br />15<br />
  • 16. The AndroidManifest.xml File<br />It also declares the permissions that others are required to have in order to interact with the application's components.<br />It declares the minimum level of the Android API that the application requires.<br />It lists the libraries that the application must be linked against<br />Overview Presentation<br />16<br />List is not complete !!!!!<br />
  • 17. Site step: What is API level?<br />Overview Presentation<br />17<br />API Level is an integer value that uniquely identifies the framework API revision offered by a version of the Android platform.<br />The Android platform provides a framework API that applications can use to interact with the underlying Android system. The framework API consists of:<br /><ul><li>A core set of packages and classes
  • 18. A set of XML elements and attributes for declaring a manifest file
  • 19. A set of XML elements and attributes for declaring and accessing resources
  • 20. A set of Intents
  • 21. A set of permissions that applications can request, as well as permission enforcements included in the system</li></ul>Each successive version of the Android platform can include updates to the Android application framework API that it delivers. <br />
  • 22. Site step: permissions samples<br />Overview Presentation<br />18<br />Location-based services android.permission.ACCESS_COARSE_LOCATION<br />android.permission.ACCESS_FINE_LOCATION<br />Accessing contact database android.permission.READ_CONTACTS<br />android.permission.WRITE_CONTACTS<br />Accessing calendars android.permission.READ_CALENDAR<br />android.permission.WRITE_CALENDAR<br />Changing general phone android.permission.SET_ORIENTATION<br /> settings android.permission.SET_TIME_ZONE<br />android.permission.SET_WALLPAPER<br />Making calls android.permission.CALL_PHONE<br />android.permission.CALL_PRIVILEGED<br />
  • 23. Example AndroidManifest.xml <br />Overview Presentation<br />19<br /><?xml version="1.0" encoding="utf-8"?><br /><manifest xmlns:android="http://schemas.android.com/apk/res/android"<br /> package="eu.laracker"<br />android:versionCode="1"<br />android:versionName="1.0"><br /> <uses-sdkandroid:minSdkVersion="7" /><br /> <application android:icon="@drawable/icon" android:label="@string/app_name"><br /> <activity android:name=".SuperSocial"<br />android:label="@string/app_name"><br /> <intent-filter><br /> <action android:name="android.intent.action.MAIN" /><br /> <category android:name="android.intent.category.LAUNCHER" /><br /> </intent-filter><br /> </activity><br /> </application><br /></manifest><br />
  • 24. What are the main components of a Android application<br />Part I, today<br />Short introduction in Eclipse<br />AndroidManifest.xml<br />Activity<br />Intents<br />Application resources<br />Layouts<br />Localization<br />Part II, next time<br />Application preferences<br />App Widgets<br />Services<br />broadcast receivers<br />content providers<br />Overview Presentation<br />20<br />
  • 25. Activity<br />An activity is a core component of the Android platform. Each activity represents a task the application can do, often tied to a corresponding screen in the application user interface.<br />Activity is to an application what a web page is to a website. (Sort of)<br />Overview Presentation<br />21<br />
  • 26. Activities lifecycle<br />Overview Presentation<br />22<br />Activities have a well defined lifecycle. The Android OS manages your activity by changing its state.<br />Demo<br />
  • 27. What are the main components of a Android application<br />Part I, today<br />Short introduction in Eclipse<br />AndroidManifest.xml<br />Activity<br />Intents<br />Application resources<br />Layouts<br />Localization<br />Part II, next time<br />Application preferences<br />App Widgets<br />Services<br />broadcast receivers<br />content providers<br />Overview Presentation<br />23<br />
  • 28. Intents<br />Overview Presentation<br />24<br />Intents are to Android apps what hyperlinks are to websites.<br />An application can call directly a service or activity (explicit intent) or asked the Android system for registered services and applications for an intent (implicit intents).<br />Intents are asynchronous messages.<br />
  • 29. Intents / Starting activities Samples<br />Overview Presentation<br />25<br />Standard Explicit intents :<br />Intent intent = new Intent(getApplicationContext(), HelpActivity.class);<br />startActivity(intent);<br />Extra parameters:<br />Intent intent = new Intent(getApplicationContext(), HelpActivity.class);<br />intent.putExtra(“eu.laracker.supersocial.LEVEL”, 8);<br />startActivity(intent);<br />Intent callingIntent = getIntent();<br />inthelpLevel = callingIntent.getIntExtra(“eu.laracker.supersocial.LEVEL”, 1);<br />Calling with result:<br />startActivityForResult(new Intent(getApplicationContext(), HelpActivity.class);)<br />onActivityResult(intrequestCode, intresultCode, Intent data);<br />
  • 30. Using Intents to Launch Other Applications<br />Overview Presentation<br />26<br />Initially, an application may only be launching activity classes defined within its<br />own package. However, with the appropriate permissions, applications may also<br />launch external activity classes in other applications.<br />Launching the built-in web browser and supplying a URL address<br />Launching the web browser and supplying a search string<br />Launching the built-in Dialer application and supplying a phone number<br />Launching the built-in Maps application and supplying a location<br />Launching Google Street View and supplying a location<br />Launching the built-in Camera application in still or video mode<br />Launching a ringtone picker<br />Recording a sound<br />
  • 31. Using Intents to Launch Other Applications samples<br />Overview Presentation<br />27<br />Launching the built-in web browser and supplying a URL address<br />Implicit Intents:<br />Uri address = Uri.parse(“http://www.planon-fm.com”);<br />Intent surf = new Intent(Intent.ACTION_VIEW, address);<br />startActivity(surf);<br />AndroidManifest.xml<br /><uses-permissionandroid:name="android.permission.INTERNET" /><br />Which browser is openend is unknown, Android OS looks at the registered intend filters.<br />
  • 32. Registering via Intentfilter sample I<br />Overview Presentation<br />28<br />This filter declares the main entry point of a application. <br /><ul><li>The standard MAIN action is an entry point that does not require any other information in the Intent (no data specification, for example).
  • 33. The LAUNCHER category says that this entry point should be listed in the application launcher.</li></li></ul><li>Registering via Intentfilter sample II<br />Overview Presentation<br />29<br />
  • 34. Site step: dialogs<br />Overview Presentation<br />30<br />There are quite a few types of ready-made dialog types available for use in addition to the basic dialog. These are <br /><ul><li>AlertDialog ,
  • 35. CharacterPickerDialog
  • 36. DatePickerDialog,
  • 37. ProgressDialog
  • 38. TimePickerDialog.</li></ul>You can also create an entirely custom dialog by designing an XML layout file<br />Demo<br />
  • 39. What are the main components of a Android application<br />Part I, today<br />Short introduction in Eclipse<br />AndroidManifest.xml<br />Activity<br />Intents<br />Application resources<br />Layouts<br />Localization<br />Part II, next time<br />Application preferences<br />App Widgets<br />Services<br />broadcast receivers<br />content providers<br />Overview Presentation<br />31<br />
  • 40. Examples of application resources<br />Overview Presentation<br />32<br />
  • 41. Application resources<br />Overview Presentation<br />33<br />You should always externalize resources such as images and strings from your application code, so that you can maintain them independently. Externalizing your resources also allows you to provide alternative resources that support specific device configurations such as different languages or screen sizes<br />Resource types are defined with special XML tags and organized into specially<br />named project directories. Some examples of /res subdirectories are /drawable,<br />/layout, and /values.<br />
  • 42. For any type of resource, you can specify default and multiple alternative resources for your application:<br /><ul><li>Default resources are those that should be used regardless of the device configuration or when there are no alternative resources that match the current configuration.
  • 43. Alternative resources are those that you've designed for use with a specific configuration. To specify that a group of resources are for a specific configuration, append an appropriate configuration qualifier to the directory name.</li></ul>Application resources<br />Overview Presentation<br />34<br />Demo<br />
  • 44. Sample resource file String <br />Overview Presentation<br />35<br />You can use string resources anywhere your application needs to display text. You<br />tag string resources with the <string> tag and store them in the resource file<br />/res/values/strings.xml.<br /><?xml version=”1.0” encoding=”utf-8”?><br /><resources><br /> <string name=”app_name”>Name this App</string><br /> <string name=”hello”>Hello</string><br /></resources><br />Referenced in XML: @string/hello<br />Referenced in Java: getResources().getString(R.string.hello);<br />
  • 45. Sample resource file Drawable<br />Overview Presentation<br />36<br />Drawable resources, such as image files, must be saved under the /res/drawable<br />project directory.<br />Referenced in XML: @drawable/icon<br />Referenced in Java: <br />logoView.setImageResource(R.drawable.icon);<br />AndroidManifest.xml snippet: <br /><application android:icon="@drawable/icon" android:label="@string/app_name"><br />
  • 46. Layouts (A world on his own)<br />Overview Presentation<br />37<br />Layout files often define an entire screen and are associated with a specific activity,<br />but they need not be. Layout resources can also define part of a screen and<br />can be included within another layout.<br />Layouts can also be created, modified, and used at runtime. However, in most<br />cases, using the XML layout files greatly improves code clarity and reuse.<br />Idea for next time ?????<br />
  • 47. What are the main components of a Android application<br />Part I, today<br />AndroidManifest.xml<br />Activity<br />Intents<br />Application resources<br />Layouts<br />Localization<br />Part II, next time<br />Application preferences<br />App Widgets<br />Services<br />broadcast receivers<br />content providers<br />Overview Presentation<br />38<br />
  • 48. Example AndroidManifest.xml <br />Overview Presentation<br />39<br /><?xml version="1.0" encoding="utf-8"?><br /><manifest xmlns:android="http://schemas.android.com/apk/res/android"<br /> package="eu.laracker"<br />android:versionCode="1"<br />android:versionName="1.0"><br /> <uses-sdkandroid:minSdkVersion="7" /><br /> <application android:icon="@drawable/icon" android:label="@string/app_name"><br /> <activity android:name=".SuperSocial"<br />android:label="@string/app_name"><br /> <intent-filter><br /> <action android:name="android.intent.action.MAIN" /><br /> <category android:name="android.intent.category.LAUNCHER" /><br /> </intent-filter><br /> </activity><br /> </application><br /></manifest><br />
  • 49. Resources on the web<br />http://developer.android.com/index.html<br />http://www.vogella.de<br />Tuturial<br />http://developer.android.com/resources/tutorials/notepad/index.html<br />Overview Presentation<br />40<br />
  • 50. Henk Laracker Planon<br />Thank you for your attention.<br />

×