Your SlideShare is downloading. ×
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC


Published on

Published in: Technology, Education

  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Android Development with ArcGIS Server
    Esri Dev Meet Up
    Charlotte, NC
    October 19th, 2010
    Jim Tochterman, VP - Research & Development
  • 2. What is Android?
    Software stack for mobile devices, formally introduced in 2008
    Unlike other mobile devices, not a proprietary OS
    Palm OS
    Blackberry OS
    Combination of three (3) components
    Free, open source OS for mobile devices
    Free, open source development environment for creating mobile applications
    Devices that run the Android OS and the applications created for it
  • 3. Why choose Android over iPhone?
    iPhone cost was prohibitive for widespread deployment
    No Objective-C / Cocoa developers on staff
    No Mac hardware available
    Technical Limitations / General Annoyances:
    GSM coverage is not good in the Southeast (even in Urban Areas)
    iPhone did not support “backgrounding” (at the time)
    Deployment Hurdles (App Store, Code Signing, etc.)
    Xcode is quite possibly the worst IDE ever!
    Comfort Level:
    If you do Flex or Java development already the tools are very similar!
  • 4. Why develop with Android?
    Background Services
    Event driven model that works silently while other applications are being used.
    Shared Data & Inter-Process Communication
    Applications can exchanges messages, perform processing, and share data.
    Widgets & Live Folders
    Allows you to create windows into your applications from your device’s home screen.
    Application Equality
    No differentiation between native applications and those developed by third parties.
  • 5. Pros & Cons with Android Development
    Good Development Tools and Samples
    No App Store / Market Requirement!
    Build and Deploy with Dropbox if you feel like it
    Terminology! What in the hell is an Activity and a Intent!? (The names can seem strange, but based upon what they do)
    More work to make a “Pretty” app
  • 6. Where Do I Get Started?
    Download Eclipse (or my preference MotoDev Studio)
    Download Android ADT and SDK
    Start Playing!
  • 7. Design Considerations For Mobile Devices
    Low Processing Speed
    Optimize code to run quick and efficiently
    Limited storage & memory
    Minimize application size
    Reuse and share data (using databases & saved files)
    Limited bandwidth & high latency
    Allow for slow, intermittent network connections
    Limited Battery Life
    Avoid expensive operations where/when possible
    Limit sensor access when not being used
  • 8. How do I use ArcGIS Server with Android?
    ArcGIS API for Android is coming! Finally!!
  • 9. How do I use ArcGIS Server with Android now!?
    Sign up for the Early Adopter Program – OR -
    Use ArcGIS Server REST API & Web Services!
    WMS Service provides Map Tiles for Overlays
    Feature Service provides ability to retrieve and/or edit data
  • 10. Demo…
    Integrating ArcGIS Server Data & Services with Google Maps API (via REST API)
  • 11. Creating Map Overlay (
    public class MainActivity extends MapActivity implements OnSharedPreferenceChangeListener
    private final static String TAG = "MainActivity";

    AtlanticStormsOverlay = new WMSOverlay("", layerIds, myMapView);
    overlays.add(AtlanticStormsOverlay );

  • 12. Creating Map Overlay (
    public class WMSOverlay extends Overlay
    private final static String TAG = ”WMSOverlay";

    public WMSOverlay(Stringurl, String layers, MapViewmapView)

    wmsClient = new WMSLoader(url, layers);
    intleftLongitude = mapView.getMapCenter().getLongitudeE6() - mapView.getLongitudeSpan()/2;
    intrightLongitude = mapView.getMapCenter().getLongitudeE6()+ mapView.getLongitudeSpan()/2;
    intupperLatitude = mapView.getMapCenter().getLatitudeE6() + mapView.getLatitudeSpan()/2;
    intlowerLatitude = mapView.getMapCenter().getLatitudeE6() - mapView.getLatitudeSpan()/2;
    GeoPointupperLeft = new GeoPoint(upperLatitude,leftLongitude);
    GeoPointlowerRight = new GeoPoint(lowerLatitude,rightLongitude);
    image = wmsClient.loadMap(mapView.getWidth(), mapView.getHeight(), upperLeft, lowerRight);
  • 13. Creating Map Overlay (
    public class WMSLoader
    public static String TAG = "WMSLoader";
    public String serverUrl;
    public String layerIds;

    public Bitmap loadMap(int width, int height, GeoPointul, GeoPointlr) {
    URL url = null;
    try {
    url = new URL(String.format(serverUrl +
    "LAYERS=" + layerIds + "&TRANSPARENT=true&FORMAT=image/ png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/ vnd.ogc.se_inimage&SRS=EPSG:4326" + "" +
    "&BBOX=%f,%f,%f,%f&WIDTH=%d&HEIGHT=%d", ul.getLongitudeE6()/1E6, lr.getLatitudeE6()/1E6, lr.getLongitudeE6 ()/1E6, ul.getLatitudeE6()/1E6, width, height));

    Bitmap image = BitmapFactory.decodeStream(input);
    return image;
  • 14. Creating Data via REST API (
    public class MainActivity extends MapActivity implements OnSharedPreferenceChangeListener

    public booleanonCreateOptionsMenu(Menu menu)
    boolean result = super.onCreateOptionsMenu(menu);

    menu.add(0, 996, Menu.NONE, "SITREP Notes").setIcon(android.R.drawable.ic_menu_myplaces);

    public booleanonOptionsItemSelected(MenuItem item)
    Intent mapIntent = new Intent(Intent.ACTION_VIEW);
    switch (item.getItemId())

    case (996) :
    Intent dca = new Intent(this, DataCollectionActivity.class);
    startActivityForResult(dca, 996);
    return true;

    // Return false if you have not handled the menu item.
    return false;
  • 15. Creating Data via REST API (
    public class DataCollectionActivity extends Activity
    static final String TAG = "DataCollectionActivity";

    pointButton.setOnClickListener(newOnClickListener() {
    public void onClick(Viewv) {
    //Ask the user if they want to post report
    new AlertDialog.Builder(DataCollectionActivity.this)
    .setTitle("Post Note")
    .setMessage("Are you sure you want to post this note?")
    .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int which) {
    Bundle bundle = new Bundle();
    bundle.putString("type", pointSpinner.getSelectedItem().toString());
    bundle.putString("reportdatetime", deviceData.getReportDateTime());
    bundle.putString("comments", commentsEditText.getText().toString());
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setClassName("", "");
    .setNegativeButton("No", null)

  • 16. Creating Data via REST API (
    public class NoteCreateActivity extends Activity
    static final String TAG = "NoteCreateActivity";
    private String serverUrl = "";

    String attrString = ",'attributes':{";
    attrString = attrString + "'TYPE':'" + type + "'," + "'RPTDATETIME':'" + reportdatetime + "', " + "'SUMMARY':'" + comments + "'";
    attrString = attrString + "}";
    String coordString = "[{'geometry':{";
    coordString = coordString + "'x':" + loc.getLongitude() + ",'y':" + loc.getLatitude();
    coordString = coordString + "}" + attrString + "}]";
    HttpClienthttpclient = new DefaultHttpClient();
    HttpPosthttppost = new HttpPost(serverUrl);
    try {
    // Add your data
    List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
    nameValuePairs.add(newBasicNameValuePair("features", coordString));
    // Execute HTTP Post Request
    httpResponse = httpclient.execute(httppost);

  • 17. Demo…
    Sneak Peek ofApp Built w/ ArcGIS for Android API
  • 18. Questions?
  • 19. Want More Information?
    WROX Book: Professional Android 2 Application Development (Meier)
    ISBN#: 978-0-470-56552-0