Creating your first Android App to view Map from Autodesk Infrastructure Map Server(AIMS)

By Partha Sarkar

The very
first step is setting up the development environment with SDK, Tools and
configuring them correctly. I think, Building
Your First App
is the first place you need to go to understand what SDK,
Tools are required and how to configure them.

 

Once you have
completed your "Hello World" app and some of the tutorial android
apps, you are almost ready to see how you can create a simple mapping
application to view Map served from Autodesk Infrastructure Map Server.

 

In this
example I used WebView
class from Android APIs. Here is the code snippet :

import android.app.Activity;

import android.os.Bundle;

import android.webkit.WebView;

import android.webkit.WebViewClient;

 

public class AIMSWebViewActivity extends Activity {

 

 WebView mWebView;

 

 @Override

 public void onCreate(Bundle savedInstanceState) {

  super.onCreate(savedInstanceState);

  setContentView(R.layout.main);

 

  // This initializes the member WebView

  // with the one from the Activity layout;

  // requests a WebSettings object with getSettings();

  // and enables JavaScript for the WebView with

  // setJavaScriptEnabled(boolean).

  // Finally, an initial web page is loaded with loadUrl(String).

 

  mWebView = (WebView) findViewById(R.id.webview);

  mWebView.getSettings().setJavaScriptEnabled(true);

  mWebView.getSettings().setBuiltInZoomControls(true);

  mWebView.loadUrl("http://www.MyAIMSSite.com/MapView/");

 

  // setContentView(mWebView); // this works too

 

  mWebView.setWebViewClient(new HelloWebViewClient());

 }

 

 private class HelloWebViewClient extends WebViewClient {

  @Override

  public boolean shouldOverrideUrlLoading(WebView view, String url) {

   view.loadUrl(url);

   return true;

  }

 }

}

 

Screenshot of
Android AIMS Map View application :

 
AIMS_Android_webview 

 

And here is a
short video of the same running in Emulator.

 

I hope this
is useful to you!


Comments

One response to “Creating your first Android App to view Map from Autodesk Infrastructure Map Server(AIMS)”

  1. there a lot interesting android app on play store, and the app based map with gps features is one of most download for its usability.

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading