2011-07-19 11 views
2

私はマニフェストファイルここで私はそれを実行したとき、それはGPSアンドロイドエラー!

07-19 13:04:46.372: WARN/System.err(430): IOException processing: 26 
07-19 13:04:46.381: WARN/System.err(430): java.io.IOException: Server returned: 3 
07-19 13:04:46.401: WARN/System.err(430):  at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115) 
07-19 13:04:46.421: WARN/System.err(430):  at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473) 
07-19 13:04:46.451: WARN/System.err(430):  at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117) 
07-19 13:04:46.471: WARN/System.err(430):  at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994) 
07-19 13:04:46.491: WARN/System.err(430):  at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702) 
07-19 13:04:46.511: WARN/System.err(430):  at java.lang.Thread.run(Thread.java:1019) 

ログの猫に何もnを与え

package org.example.location; 

import com.google.android.maps.MapActivity; 

import android.app.Activity; 
import android.content.Context; 
import android.location.Criteria; 
import android.location.Location; 
import android.location.LocationListener; 
import android.location.LocationManager; 
import android.os.Bundle; 
import android.widget.TextView; 

public class WhereAmI extends MapActivity { 
/** Called when the activity is first created. */ 
@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.main); 
    LocationManager locationManager; 
    String context = Context.LOCATION_SERVICE; 
    locationManager = (LocationManager)getSystemService(context); 
    //String provider = LocationManager.GPS_PROVIDER; 
    Criteria criteria = new Criteria(); 
    criteria.setAccuracy(Criteria.ACCURACY_FINE); 
    criteria.setAltitudeRequired(false); 
    criteria.setBearingRequired(false); 
    criteria.setCostAllowed(true); 
    criteria.setPowerRequirement(Criteria.POWER_LOW); 
    String provider = locationManager.getBestProvider(criteria, true); 

    Location location = locationManager.getLastKnownLocation(provider); 
    updateWithNewLocation(location); 

    locationManager.requestLocationUpdates(provider, 2000, 10, locationListener); 
} 

private void updateWithNewLocation(Location location) { 
    String latLongString; 
    TextView myLocationText; 
    myLocationText = (TextView)findViewById(R.id.myLocationText); 
    if (location != null) { 
     double lat = location.getLatitude(); 
     double lng = location.getLongitude(); 
     latLongString = "Lat:" + lat + "\nLong:" + lng; 
    } else { 
     latLongString = "No location found"; 
    } 
    myLocationText.setText("Your Current Position is:\n" +latLongString); 
} 

private final LocationListener locationListener = new LocationListener() { 
    public void onLocationChanged(Location location) { 
    updateWithNewLocation(location); 
    } 
    public void onProviderDisabled(String provider){ 
    updateWithNewLocation(null); 
    } 
    public void onProviderEnabled(String provider){ } 
    public void onStatusChanged(String provider, int status, 
    Bundle extras){ } 
    }; 

@Override 
protected boolean isRouteDisplayed() { 
    // TODO Auto-generated method stub 
    return false; 
} 

}

ここでGPSをテストするために、小さな例を作成しよう

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="org.example.location" 
    android:versionCode="1" 
    android:versionName="1.0"> 
<uses-sdk android:minSdkVersion="8" /> 

<application android:icon="@drawable/icon" android:label="@string/app_name"> 
<uses-library android:name="com.google.android.maps"/> 
    <activity android:name=".WhereAmI" 
       android:label="@string/app_name"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 

</application> 

<uses-permission android:name="android.permission.INTERNET"/> 
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> 
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> 
</manifest> 

答えて

1

AndroidManifest.xmlに適切なアクセス許可が設定されていますか?

[更新] 有効で登録されたGoogleマップのキーを提供しましたか?私はそれがここの問題だと信じています。

[更新] Googleマップのキーを登録して提供する方法については、このチュートリアル:http://www.pocketvnc.com/blog/?page_id=511をご確認ください。

+0

em私は上記の私のマニフェストファイルを見ていると思います。 – sayvortana

+0

更新しました – sparkymat

+0

これで問題は解決しましたか? – sparkymat

関連する問題