Android Application Advancement Instructional exercise

0
0
2881 days ago, 924 views
PowerPoint PPT Presentation
July 2005, Google obtained Android, Inc. November 2007, Open Handset ... Case: Android ships with various substance suppliers for regular information sorts ...

Presentation Transcript

Slide 1

Android Application Development Tutorial Accessing Sensors and the Network Deepa Shinde and Cindy Atherton

Slide 2

Background Introduction to Android Overview of Sensors Programming Tutorial 1: Tracking area with GPS and Google Maps Overview of Networking Programming Tutorial 2: Downloading from the Internet Programming Tutorial 3: Sending/Receiving SMS Messages Questions/Comments Resources Topics

Slide 3

Introduction to Android A brief manual for the Android Application Development Environment

Slide 4

Software stage from Google and the Open Handset Alliance July 2005, Google gained Android, Inc. November 2007, Open Handset Alliance framed to create open norms for cell phones October 2008, Android accessible as open source December 2008, 14 new individuals joined Android extend Background

Slide 5

April 30, 2009: Official 1.5 Cupcake discharge September 15, 2009: 1.6 SDK Donut discharge October 26, 2009: 2.0 SDK Éclair discharge Updates to the Éclair discharge: 2.0.1 on December 3, 2009 2.1 on January 12, 2010 Update History

Slide 6

Platform Versions

Slide 7

Built-in Apps ≡ Apps made in SDK Leverage Linux portion to interface with equipment Open source stage advances improvement from worldwide group Android and the Hardware

Slide 8

Reuse and substitution of parts Dalvik virtual machine Integrated program Optimized representation SQLite Media bolster GSM Telephony Bluetooth, EDGE, 3G, and WiFi Camera, GPS, compass, and accelerometer Rich advancement environment Android Features

Slide 9

Android Architecture

Slide 10

Apps are composed in Java Bundled by Android Asset Packaging Tool Every App runs its own particular Linux handle Each procedure has it's own particular Java Virtual Machine Each App is allocated a one of a kind Linux client ID Apps can have a similar client ID to see each other's documents Application Fundamentals

Slide 11

Activity Present a visual UI for one centered attempt the client can embrace Example: a rundown of menu things clients can browse Services Run out of sight for an inconclusive timeframe Example: ascertain and give the outcome to exercises that need it Broadcast Receivers Receive and respond to communicate declarations Example: declarations that the time zone has changed Content Providers Store and recover information and make it open to all applications Example: Android ships with various substance suppliers for regular information sorts (e.g., sound, video, pictures, individual contact data, and so forth.) Intents Hold the substance of a message Example: pass on a demand for an action to display a picture to the client or let the client alter some content Application Components

Slide 12

http://developer.android.com/sdk/installing.html Preparing your framework and framework necessities Downloading and Installing the SDK Installing ADT module for Eclipse Adding Platforms and Components Exploring the SDK Completing instructional exercises Troubleshooting Installation

Slide 13

Overview of Sensors The Android Sensor Platform and how to utilize it

Slide 14

Developer's can get to "treats" Hardware abilities made accessible Open Source Platform

Slide 15

Hardware-situated Features

Slide 16

Sensor sort (Sensor class) Orientation, accelerometer, light, attractive field, nearness, temperature, and so on. Inspecting rate Fastest, diversion, ordinary, UI. At the point when an application demands a particular inspecting rate, it is truly just a clue, or recommendation, to the sensor subsystem. There is no certification of a specific rate being accessible. Precision High, low, medium, temperamental. Sensor and SensorManager

Slide 17

Programming Tutorial Simulating an Android application that gets to situating sensors

Slide 18

Must have Eclipse IDE introduced Must have Android SDK introduced Must know about Java Must have the outside Google Maps library introduced in your SDK surroundings. The Maps library is incorporated with the Google APIs add-on, which you can introduce utilizing the Android SDK and AVD Manager. Planning for the Tutorial

Slide 19

A Google Maps API key is required to coordinate Google Maps into your Android application. To apply for a key: Locate the SDK troubleshoot endorsement in the default organizer of "C:\Documents and Settings\<username>\Local Settings\Application Data\Android". The filename of the troubleshoot keystore is debug.keystore . Duplicate the debug.keystore record to an organizer named C:\Android\. Open the order window and explore to C:\Program Files\Java\< JDK_version_number >\bin to find the Keytool.exe. Execute the accompanying to extricate the MD5 unique mark: keytool.exe - list - moniker androiddebugkey - keystore "C:\Android\debug.keystore" - storepass android - keypass android Copy the MD5 authentication unique finger impression and explore your web program to: http://code.google.com/android/maps-programming interface signup.html. Take after the directions on the page to finish the application and get the Google Maps key. For more data on utilizing Google Maps as a part of Android application advancement: http://mobiforge.com/creating/story/utilizing google-maps-android Get a Google Maps API Key

Slide 20

Defines the framework picture and gadget settings utilized by the Emulator To make an AVD in Eclipse: Select Window > Android SDK and AVD Manager. The Android SDK and AVD Manager shows. Ensure the passage for Virtual Devices is chosen and snap New. The Create new AVD window shows. Enter a Name for the AVD. Select Google APIs (API level 3) as the Target. Click Create AVD. Close the Android SDK and AVD Manager. Make an Android Virtual Device (AVD)

Slide 21

To make the venture in Eclipse: Select File > New > Project. Select Android Project in the Android organizer and snap Next. Enter GPSSimulator as the Project Name. Select Google APIs (Platform 1.5) as the Build Target. Enter GPSSimulator as the Application name. Enter com.android.gpssimulator as the Package name. Enter GPSSimulator as the Activity name. Click Finish. Make the Android Project

Slide 22

The New Android Project

Slide 23

Add consents for GPS To change the AndroidManifest.xml record: Click on the res envelope in the GPSSimulator extend. Double tap AndroidManifest.xml to show the GPSSimulator Manifest. Enter the accompanying lines before the application tag. <uses-consent android:name =" android.permission.ACCESS_FINE_LOCATION "/> Save the progressions to the document. Alter the AndroidManifest.xml File

Slide 24

open class GPSSimulator amplifies Activity { private LocationManager lm; private locationListener ;/Called when the movement is initially made. @Override open void onCreate (Bundle savedInstanceState ) { super.onCreate ( savedInstanceState ); setContentView ( R.layout.main );/utilize the LocationManager class to acquire GPS areas lm = ( LocationManager ) getSystemService ( Context.LOCATION_SERVICE ); locationListener = new MyLocationListener (); lm.requestLocationUpdates ( LocationManager.GPS_PROVIDER , 0, 0, locationListener ); } Add LocationManager to get Updates

Slide 25

private class MyLocationListener actualizes LocationListener { @Override open void onLocationChanged (Location loc) { if (loc != invalid) { Toast.makeText ( getBaseContext (), "Location changed : Lat: " + loc.getLatitude () + " Lng : " + loc.getLongitude (), Toast.LENGTH_SHORT ).appear(); } @Override open void onProviderDisabled (String supplier) {/TODO Auto-created technique stub } @Override open void onProviderEnabled (String supplier) {/TODO Auto-produced strategy stub } @Override open void onStatusChanged (String supplier, int status, Bundle additional items) {/TODO Auto-created strategy stub } Add MyLocationListener

Slide 26

To test in Eclipse: Switch to DDMS see. Discover the Location Controls in the Emulator Control tab. Tap the GPX tab and snap Load GPX. Find and select the GPX record. Click Play to start sending directions to the Emulator. Test the GPSSimulator

Slide 27

Update the Manifest with two lines. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android ="http://schemas.android.com/apk/res/android" package=" com.android.GPSSimulator "> <uses-consent android:name =" android.permission.INTERNET "/> <uses-authorization android:name =" android.permission.ACCESS_FINE_LOCATION "/> <application android:icon ="@ drawable/icon" android:label ="@string/app_name "> <uses-library android:name =" com.google.android.maps "/> <activity android:name =".GPS" android:label ="@string/app_name "> <intent-filter> <action android:name =" android.intent.action.MAIN "/> <category android:name =" android.intent.category.LAUNCHER "/> </plan filter> </activity> </application> </manifest> Add capacity to utilize Google Maps

Slide 28

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <com.google.android.maps.MapView android:id="@+id/mapview1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:enabled="true" android:clickable="true" android:apiKey="Your API Key Here"/> </LinearLayout> Add MapView to main.xml

Slide 29

open class GPSSimulator

SPONSORS