2013-03-22 2 views
3

http://bingmapsandroidsdk.codeplex.com/을 Android의 Google지도 대신 빙지도를 사용하도록 설정했습니다. 나는 그것을 설정할 수 없었기 때문에.Android 에뮬레이터의 빙지도가 작동하지만 기기에 없습니다.

내 에뮬레이터에서 Bing 맵을 실행할 수 있지만 내 장치 (Galaxy S2)에서 실행할 수 없습니다.

휴대 전화에 Wi-Fi 연결이 있지만로드 화면을 지나갈 수 없습니다.

나는이 질문을 확인하지만 Working on Emulator but not on the real Android device

그래서 내 코드 문제가 해결되지 않습니다

매니페스트

<uses-permission android:name="android.permission.INTERNET"/> 
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> 
<uses-permission android:name="android.permission.CALL_PHONE"/> 
<uses-permission android:name="android.permission.ACCESS_GPS"></uses-permission> 
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="15"/> 

<application android:icon="@drawable/bingmaps_icon" android:label="@string/app_name" android:allowBackup="false"> 
    <activity android:name=".MainActivity" 
       android:label="@string/app_name"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 

    <activity android:name="SplashActivity"></activity> 
</application> 

이 활동 copi 시작을 빙-SDK 로그 캣에서

package org.bingmaps.app; 

    import java.util.HashMap; 

    import org.bingmaps.app.R; 
import org.bingmaps.sdk.BingMapsView; 
import org.bingmaps.sdk.Coordinate; 
import org.bingmaps.sdk.EntityClickedListener; 
import org.bingmaps.sdk.EntityLayer; 
import org.bingmaps.sdk.MapLoadedListener; 
import org.bingmaps.sdk.MapMovedListener; 
import org.bingmaps.sdk.MapStyles; 
import org.bingmaps.sdk.Pushpin; 
import org.bingmaps.sdk.PushpinOptions; 
import android.app.Activity; 
import android.app.ProgressDialog; 
import android.location.Location; 
import android.location.LocationListener; 
import android.os.Bundle; 
import android.os.Handler; 
import android.os.Message; 
import android.view.Menu; 
import android.view.MenuInflater; 
import android.view.MenuItem; 
import android.view.View; 
import android.view.View.OnClickListener; 
import android.view.Window; 
import android.widget.ViewFlipper; 
import android.widget.ZoomButton; 

public class MainActivity extends Activity { 
private BingMapsView bingMapsView; 
private GPSManager _GPSManager; 
private EntityLayer _gpsLayer; 
private ProgressDialog _loadingScreen; 

private Activity _baseActivity; 

CharSequence[] _dataLayers; 
boolean[] _dataLayerSelections; 

@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 

    requestWindowFeature(Window.FEATURE_NO_TITLE); 

    //OPTION Lock map orientation 
    setRequestedOrientation(1); 

    setContentView(R.layout.main); 

    Initialize(); 
} 

private void Initialize() 
{ 
    _baseActivity = this; 
    _GPSManager = new GPSManager((Activity)this, new GPSLocationListener()); 

    //Add more data layers here 
    _dataLayers = new String[] { getString(R.string.traffic)}; 
    _dataLayerSelections = new boolean[ _dataLayers.length ]; 

    _loadingScreen = new ProgressDialog(this); 
    _loadingScreen.setCancelable(false); 
    _loadingScreen.setMessage(this.getString(R.string.loading) + "..."); 

    bingMapsView = (BingMapsView) findViewById(R.id.mapView); 







    //Create handler to switch out of Splash screen mode 
    final Handler viewHandler = new Handler() { 
     public void handleMessage(Message msg) { 
      ((ViewFlipper) findViewById(R.id.flipper)).setDisplayedChild(1); 
     } 
    }; 

    //Add a map loaded event handler 
    bingMapsView.setMapLoadedListener(new MapLoadedListener() { 
     public void onAvailableChecked() { 
      // hide splash screen and go to map 
      viewHandler.sendEmptyMessage(0); 

      //Add GPS layer 
      _gpsLayer = new EntityLayer(Constants.DataLayers.GPS); 
      bingMapsView.getLayerManager().addLayer(_gpsLayer); 
      UpdateGPSPin(); 
     } 
    }); 

    //Add a entity clicked event handler 
    bingMapsView.setEntityClickedListener(new EntityClickedListener() { 
     public void onAvailableChecked(String layerName, int entityId) { 
      HashMap<String, Object> metadata = bingMapsView.getLayerManager().GetMetadataByID(layerName, entityId); 
      DialogLauncher.LaunchEntityDetailsDialog(_baseActivity, metadata); 
     } 
    }); 

    //Load the map 
    bingMapsView.loadMap(Constants.BingMapsKey, _GPSManager.GetCoordinate(), Constants.DefaultGPSZoomLevel, this.getString(R.string.mapCulture)); 

    // Create zoom out button functionality 
    final ZoomButton zoomOutBtn = (ZoomButton) findViewById(R.id.zoomOutBtn); 
    zoomOutBtn.setOnClickListener(new OnClickListener() { 
     public void onClick(View v) { 
      bingMapsView.zoomOut(); 
     } 
    }); 

    // Create zoom button in functionality 
    final ZoomButton zoomInBtn = (ZoomButton) findViewById(R.id.zoomInBtn); 
    zoomInBtn.setOnClickListener(new OnClickListener() { 
     public void onClick(View v) { 
      bingMapsView.zoomIn(); 
     } 
    }); 




}  

@Override 
public boolean onCreateOptionsMenu(Menu menu) { 
    MenuInflater inflater = getMenuInflater(); 
    inflater.inflate(R.layout.menu, menu); 
    return true; 
} 

@Override 
public boolean onOptionsItemSelected(MenuItem item) { 
    // Handle item selection 
    switch (item.getItemId()) { 
     //Map Mode menu items 
     case R.id.autoBtn: 
      bingMapsView.setMapStyle(MapStyles.Auto); 
      item.setChecked(!item.isChecked()); 
      return true; 
     case R.id.roadBtn: 
      bingMapsView.setMapStyle(MapStyles.Road); 
      item.setChecked(!item.isChecked()); 
      return true; 
     case R.id.aerialBtn: 
      bingMapsView.setMapStyle(MapStyles.Aerial); 
      item.setChecked(!item.isChecked()); 
      return true; 
     case R.id.birdseyeBtn: 
      bingMapsView.setMapStyle(MapStyles.Birdseye); 
      item.setChecked(!item.isChecked()); 
      return true; 
     //More option items 
     case R.id.aboutMenuBtn: 
      DialogLauncher.LaunchAboutDialog(this); 
      return true; 
     case R.id.layersMenuBtn: 
      DialogLauncher.LaunchLayersDialog(this, bingMapsView, _dataLayers, _dataLayerSelections); 
      return true; 
     case R.id.clearMapMenuBtn: 
      bingMapsView.getLayerManager().clearLayer(null); 

      //unselect all layers 
      for(int i=0;i<_dataLayerSelections.length;i++){ 
       _dataLayerSelections[i] = false; 
      } 

      //re-add GPS layer 
      bingMapsView.getLayerManager().clearLayer(Constants.DataLayers.GPS); 
      UpdateGPSPin(); 
      return true; 
     //GPS Menu Item 
     case R.id.gpsMenuBtn: 
      Coordinate coord = _GPSManager.GetCoordinate(); 

      if(coord != null){ 
       //Center on users GPS location 
       bingMapsView.setCenterAndZoom(coord, Constants.DefaultGPSZoomLevel); 
      } 
      return true; 
     //Search Menu Item 
     case R.id.searchMenuBtn: 
      DialogLauncher.LaunchSearchDialog(this, bingMapsView, loadingScreenHandler); 
      return true;  
     //Directions Menu Item 
     case R.id.directionsMenuBtn: 
      DialogLauncher.LaunchDirectionsDialog(this, bingMapsView, loadingScreenHandler); 
      return true; 
     default: 
      return super.onOptionsItemSelected(item); 
    } 
} 

private void UpdateGPSPin(){   
    PushpinOptions opt = new PushpinOptions(); 
    opt.Icon = Constants.PushpinIcons.GPS; 
    Pushpin p = new Pushpin(_GPSManager.GetCoordinate(), opt); 
    if (p.Location != null) {  
     _gpsLayer.clear(); 
     _gpsLayer.add(p); 
     _gpsLayer.updateLayer(); 
    } 
} 

@SuppressWarnings("unused") 
private final MapMovedListener mapMovedListener = new MapMovedListener() { 
    public void onAvailableChecked() { 
     //OPTION Add logic to Update Layers here. 
     //This will update data layers when the map is moved. 
    } 
}; 

/** 
* Handler for loading Screen 
*/ 
protected Handler loadingScreenHandler = new Handler() { 
    public void handleMessage(Message msg) { 
     if (msg.arg1 == 0) { 
      _loadingScreen.hide(); 
     } else { 
      _loadingScreen.show(); 
     } 
    } 
}; 

public class GPSLocationListener implements LocationListener { 
    public void onLocationChanged(Location arg0) { 
     UpdateGPSPin(); 
    } 

    public void onProviderDisabled(String arg0) { 
    } 

    public void onProviderEnabled(String arg0) { 
    } 

    public void onStatusChanged(String arg0, int arg1, Bundle arg2) { 
    } 
} 
} 

오류에서 에드 : 안드로이드에 대한

+0

에뮬레이터의 SDK는 무엇입니까? 나중에 변경하십시오. – Chauer

답변

1

빙지도 비는 안드로이드 버전 3.0 이상에서 작동하지 않습니다

관련 문제