This document provides information on using Google Maps, GPS, camera, and SD card functionality in Android applications. It discusses setting up a Maps API key, controlling map views, displaying the user's location, taking photos via intents and the camera API, permissions for hardware access, and reading/writing to the SD card. Tips are also provided such as using version control, testing on low-end devices, and using developer tools.
15. POIs on MapView
MyPOIOverlay extends ItemizedOverlay<OverlayItem>
similar to ArrayAdapter
override
protected OverlayItem createItem(int i)
public int size()
boundCenterBottom(Drawable)
keep local copy of data in overlay in case you need to show
some info for POI
18. Permissions
First you’ll need permissions
INTERNET
ACCESS_FINE_LOCATION
ACCESS_COARSE_LOCATION
Sometimes users complain about FINE_LOCATION.
Use only if you really need it.
25. Camera via Intent
Intent intent = new
Intent(MediaStore.ACTION_IMAGE_CAPTURE);
//extra to save full-image somewhere
intent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(destination));
destination = new
File(Environment.getExternalFilesDir(null),"image.jpg");
26. Camera via SurfaceHolder
for creating camera applications etc...
in 99% cases you don’t need this
http://developer.android.com/reference/android/
hardware/Camera.html
31. SD card
Check for presence and availability before using SD
String state = Environment.getExternalStorageState();
MEDIA_MOUNTED
MEDIA_MOUNTED_READ_ONLY
32. External folders
File getExternalStoragePublicDirectory (String type)
DIRECTORY_MUSIC, DIRECTORY_PODCASTS,
DIRECTORY_RINGTONES, DIRECTORY_ALARMS,
DIRECTORY_NOTIFICATIONS, DIRECTORY_PICTURES, or
DIRECTORY_MOVIES
gets scanned by media scanner
files aren’t deletes on app uninstall
File getExternalFilesDir (String type)
doesn’t get scanned by media scanner
files are deleted on app uninstall