我刚接触, 属于中间件部分,可能 还联系到 驱动,
对公司提出的 android 平台上 GPS 功能移植 这个概念一头雾水,
这具体是指 达到 什么目的??请指点下 ,android 源码GPS部分  应该 从那些 开始 阅读,, 
和 我该了解 哪些知识先。时间很急 啊,不胜感激。

解决方案 »

  1.   

    贴份网上看到的gps代码
    就这么一小段代码就完成了线上实时获得google地图,gps定位,导航的作用,加上eclipse开发的方便快捷,嘛。。只能说,android的应
    用开发的确很方便。现在看来,android开发其实最大的问题就是底层的移植了,对硬件要求太高,arm9以下想都别想,(arm920t也是老项目
    了,真正想省事还是得要arm926e以上)。注释就不用了都是android基本类和接口的使用。
    模拟器上模拟gps输入运行结果如下:package com.paad.WhereAmI;
    import java.io.IOException;
    import java.util.List;
    import java.util.Locale;
    import com.google.android.maps.GeoPoint;
    import com.google.android.maps.MapActivity;
    import com.google.android.maps.MapController;
    import com.google.android.maps.MapView;
    import com.google.android.maps.Overlay;
    import android.content.Context;
    import android.location.Address;
    import android.location.Criteria;
    import android.location.Geocoder;
    import android.location.Location;
    import android.location.LocationListener;
    import android.location.LocationManager;
    import android.os.Bundle;
    import android.view.Menu;
    import android.view.MenuItem;
    import android.widget.TextView;
    public class WhereAmI extends MapActivity {
        /** Called when the activity is first created. */
        public MapController mapController;
        public MyPositionOverlay myPosition;
        public MapView myMapView;
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            
            LocationManager locationManager;
            String context=Context.LOCATION_SERVICE;
            locationManager=(LocationManager)getSystemService(context);
            
            myMapView=(MapView)findViewById(R.id.myMapView);
            mapController=myMapView.getController();
            
            myMapView.setSatellite(true);
            myMapView.setStreetView(true);
            myMapView.displayZoomControls(false);
            
            mapController.setZoom(17);
            myPosition=new MyPositionOverlay();
            ListOverlay> overlays=myMapView.getOverlays();
            overlays.add(myPosition);
            
            Criteria criteria =new Criteria();
            criteria.setAccuracy(Criteria.ACCURACY_FINE);
            criteria.setAltitudeRequired(false);
            criteria.setBearingRequired(false);
            criteria.setCostAllowed(false);
            criteria.setPowerRequirement(Criteria.POWER_LOW);
            
            
            String provider=locationManager.getBestProvider(criteria, true);
            Location location=locationManager.getLastKnownLocation(provider);
            
            updateWithNewLocation(location);
            
            locationManager.requestLocationUpdates(provider, 3000, 0,
                    locationListener);
        }
        //TextView text;
        private void updateWithNewLocation(Location location) {
            // TODO Auto-generated method stub
            String latLongString;
            TextView myLocationText = (TextView)findViewById(R.id.myLocationText);
            
            String addressString="no address found\n";
            
            if(location!=null){
                myPosition.setLocation(location);
                Double geoLat=location.getLatitude()*1E6;
                Double geoLng=location.getLongitude()*1E6;
                GeoPoint point=new GeoPoint(geoLat.intValue(),geoLng.intValue());
                mapController.animateTo(point);
                double lat=location.getLatitude();
                double lng=location.getLongitude();
                latLongString="Lat :"+lat+"\nLong :"+lng;
                
                double latitude=location.getLatitude();
                double longitude=location.getLongitude();
                Geocoder gc=new Geocoder(this,Locale.getDefault());
                try{
                    ListAddress> addresses=gc.getFromLocation(latitude, longitude,
                            1);
                    StringBuilder sb=new StringBuilder();
                    if(addresses.size()>0){
                        Address address=addresses.get(0);
                        for(int i=0;iaddress.getMaxAddressLineIndex();i++)
                            sb.append(address.getAddressLine(i)).append("\n");
                            
                            sb.append(address.getLocality()).append("\n");
                            sb.append(address.getPostalCode()).append("\n");
                            sb.append(address.getCountryName());
                        
                        
                        
                            addressString=sb.toString();
                    }
                }catch(IOException e){}
            }else{
                latLongString="Location not found.\n";
            }
            myLocationText.setText("Your current location is:\n"+latLongString+
                    "\n"+addressString);
        }
       
        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){}
        };
       
        protected boolean isRouteDisplayed(){
            return false;
        }
       
        private static final int ZOOM_IN=Menu.FIRST;
        private static final int ZOOM_OUT=Menu.FIRST+1;
        public boolean onCreateOptionsMenu(Menu menu){
            super.onCreateOptionsMenu(menu);
            menu.add(0, ZOOM_IN, Menu.NONE, "Zoom In");
            menu.add(0, ZOOM_OUT, Menu.NONE, "Zoom Out");
            return true;
        }
       
        public boolean onOptionsItemSelected(MenuItem item){
            super.onOptionsItemSelected(item);
            
            switch(item.getItemId()){
            case (ZOOM_IN):
                mapController.zoomIn();
                return true;
            case (ZOOM_OUT):
                mapController.zoomOut();
                return true;
            }
            return true;
        }
    }
                   
                   
      

  2.   

    虽然结贴了,还是回复下,移植的就是中间件部分,驱动就没必要了,gps驱动就是串口驱动,应该是都做好了的,  其实很简单,就是把中间键,copy过去,然后改写参数,让上层能调下来,让它自己能读到串口GPS 数据,我博客有些资料,可以去看下http://blog.csdn.net/lbmygf