1

私はいつもそのメッセージを受け取ります..マップキーが間違っているとは思いません.マップを見ることができますが、私がいる場所をターゲットにすることはできません..ヘルプ:

      lmanager=(LocationManager)getSystemService(Context.LOCATION_SERVICE);

    llistener=new MyLocationListener();
    lmanager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, llistener);

}

private class MyLocationListener implements LocationListener
{

    @Override
    public void onLocationChanged(Location location) {
        Toast.makeText(getBaseContext(),"Location", Toast.LENGTH_LONG).show();
        // TODO Auto-generated method stub
        if(location!=null)
        {
            Toast.makeText(getBaseContext(),"Location changed: "+location.getLatitude()+" lang: "+ location.getLongitude() , Toast.LENGTH_SHORT).show();
        }
         p=new GeoPoint((int)(location.getLatitude()*1E6), (int)(location.getLongitude()*1E6));
        mapC.animateTo(p);
        mapC.setZoom(18);
        mv.invalidate();
    }

    @Override
    public void onProviderDisabled(String provider) {
        // TODO Auto-generated method stub
        //Toast.makeText(getBaseContext(),"Location", Toast.LENGTH_LONG).show(); //I get this toast each time :(
    }

    @Override
    public void onProviderEnabled(String provider) {
        // TODO Auto-generated method stub
        Toast.makeText(getBaseContext(),"Location", Toast.LENGTH_LONG).show();
    }

    @Override
    public void onStatusChanged(String provider, int status, Bundle extras) {
        // TODO Auto-generated method stub
        Toast.makeText(getBaseContext(),"Location", Toast.LENGTH_LONG).show();
    }

}
4

0 に答える 0