Android

Disponível somente no TrabalhosFeitos
  • Páginas : 6 (1396 palavras )
  • Download(s) : 0
  • Publicado : 9 de abril de 2013
Ler documento completo
Amostra do texto
Advanced Android Development
review of gReporter open-source project: GPS, Audio / Photo Capture, SQLite, HTTP File Upload and more!

Nathan Freitas, Oliver+Coady nathan@olivercoady.com

Android Platform Basics

Platform Features
• Application framework enabling reuse and replacement of components • Dalvik virtual machine optimized for mobile devices • Integrated browser based on theopen source WebKit engine • Optimized graphics powered by a custom 2D graphics library; 3D graphics based on the OpenGL ES 1.0 specification (hardware acceleration optional) • SQLite for structured data storage • Media support for common audio, video, and still image formats (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF) • GSM Telephony (hardware dependent) • Bluetooth, EDGE, 3G, and WiFi (hardwaredependent) • Camera, GPS, compass, and accelerometer (hardware dependent) • Rich development environment including a device emulator, tools for debugging, memory and performance profiling, and a plugin for the Eclipse IDE

What’s in an App?
Libraries Default Activity Other Other Other Activities Activities Activities Android Manifest Drawable Layouts Values Assets Service Content Manifest






Layout








Activity
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.reportform); ((Button)findViewById(R.id.btnReportFormSubmit)).setOnClickListener(this);((Button)findViewById(R.id.btnReportFormCancel)).setOnClickListener(this);

package com.openideals.inaugreport; import import import import import import import import import import import import import import import android.app.Activity; android.app.ProgressDialog; android.content.Intent; android.location.Location; android.os.Bundle; android.os.Handler; android.util.Log; android.view.View; android.view.View.OnClickListener;android.widget.ArrayAdapter; android.widget.Button; android.widget.CheckBox; android.widget.Spinner; android.widget.TextView; android.widget.Toast;

}

Toast.makeText(getBaseContext(), "There was a problem submitting your report. Wait a second, and then try again!", Toast.LENGTH_LONG).show();

import com.openideals.android.geo.LocationFinderActivity; importcom.openideals.android.ui.HorizontalSlider; import com.openideals.android.ui.HorizontalSlider.OnProgressChangeListener;

}

private void showMain () { Intent iMain = new Intent(this, LocationFinderActivity.class); startActivity(iMain); }

Android Application Examples

gReporter: open-source geotagging media capture report client for the Android Platform

http://openideals.com/greporter gReporter: what is it?
• Android client application • Captures text, audio and photo • Finds device location via GPS or Network • Submits captured data + location coordinates to any configured server via HTTP • Displays page of submitted reports or other info • Released under Apache License

Main Menu / LocationManager
• Three Button Main Menu • Activates LocationManager for GPS or Networkbasedlocation lookup • Uses a single PNG background image • Uses “toast” dialogs to display updated location information from callback

Main Menu / LocationManager
Locator.xml
((Button)findViewById(R.id.btnSubmit Audio)).setOnClickListener(this);

LocationFormActivity.java

public void startGPS () { //---use the LocationManager class to obtain GPS locations-- if (lm == null) { lm =(LocationManager) getSystemService(Context.LOCATION_SERVICE); } locationListener = new MyLocationListener(); if (lm.isProviderEnabled(LocationManager.GPS_PROVIDER)) { Log.i(TAG, "starting up GPS location provider..."); lm.requestLocationUpdates( LocationManager.GPS_PROVIDER, LOCATION_UPDATE_TIME, LOCATION_UPDATE_DISTANCE, locationListener); currentLocation =...
tracking img