Couldn't get connection factory

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Couldn't get connection factory

Postby magpor » Tue Feb 17, 2009 12:58 pm

Ok so I just started developing for the Android. Im currently setting up a simple map application and my final goal is to get augmented reality up and running.


When I run the application I get a "Couldn't get connection factory" in the log.

1. What do I need to do to get a connection factory when running on the simulator. As I understand it I need to use the DDMS development tools to send coordinates to the application to make it move right

2. Why do I get this errror? I fetched a API key with the debug certificate etc but when I try to use MyLocationOverlay I get the error. 02-17 11:58:05.509: ERROR/LocationManagerService(55): java.lang.IllegalArgumentException: provider=network

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.  
  3.  
  4.  
  5.  
  6. public class NowPlusActivity extends MapActivity implements LocationListener {
  7.  
  8.         private double START_LAT = 51.066832;
  9.  
  10.         private double START_LNG = -114.086108;
  11.  
  12.         private int START_ZOOM = 15;
  13.  
  14.         private MapController mc;
  15.  
  16.         private MapView mv;
  17.  
  18.         private View zoomView;
  19.  
  20.         private LocationManager lm;
  21.  
  22.         private MyLocationOverlay lo;
  23.  
  24.  
  25.  
  26.         public void onCreate(Bundle savedInstanceState) {
  27.  
  28.                 super.onCreate(savedInstanceState);
  29.  
  30.                 setContentView(R.layout.main);
  31.  
  32.                 initMap();
  33.  
  34.                 initLocation();
  35.  
  36.         }
  37.  
  38.  
  39.  
  40.         private void initMap() {
  41.  
  42.                 mv = (MapView) findViewById(R.id.map);
  43.  
  44.                 mc = mv.getController();
  45.  
  46.                 mc.setZoom(START_ZOOM);
  47.  
  48.                 mc.setCenter(new GeoPoint((int) (START_LAT * 1E6),
  49.  
  50.                                 (int) (START_LNG * 1E6)));
  51.  
  52.                 mv.setSatellite(true);
  53.  
  54.                 //mv.setStreetView(true);
  55.  
  56.                 LinearLayout zoom = (LinearLayout) findViewById(R.id.zoom_holder);
  57.  
  58.                 zoomView = mv.getZoomControls();
  59.  
  60.                 zoomView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT));
  61.  
  62.                 zoom.addView(zoomView);
  63.  
  64.                 mv.displayZoomControls(true);
  65.  
  66.         }
  67.  
  68.  
  69.  
  70.         private void initLocation() {
  71.  
  72.                 lm = (LocationManager) getSystemService(LOCATION_SERVICE);
  73.  
  74.                 lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000,500, this);
  75.  
  76.         }
  77.  
  78.  
  79.  
  80.         public void onLocationChanged(Location location) {
  81.  
  82.                 //List overlays = mv.getOverlays();
  83.  
  84.                 //lo = new MyLocationOverlay(this, mv);
  85.  
  86.                 //overlays.add(lo);
  87.  
  88.                 //lo.enableMyLocation();
  89.  
  90.         }
  91.  
  92.         public void onProviderDisabled(String provider){}
  93.  
  94.         public void onProviderEnabled(String provider){}
  95.  
  96.         public void onStatusChanged(String provider, int status, Bundle extras) {
  97.  
  98.                 System.out.println(provider);
  99.  
  100.         }
  101.  
  102.        
  103.  
  104.         protected boolean isRouteDisplayed() {
  105.  
  106.                 return false;
  107.  
  108.         }
  109.  
  110. }
Parsed in 0.036 seconds, using GeSHi 1.0.8.4
magpor
Freshman
Freshman
 
Posts: 8
Joined: Tue Feb 17, 2009 12:48 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests