If someone know why I can't recive the satellite information in my code with using Amap apk?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

If someone know why I can't recive the satellite information in my code with using Amap apk?

465 Views
yhm2046
Contributor II

I use android automotive 10, now I write fixed Latitude and longitude like this:

    //写死的经纬度
frameworks\base\services\core\java\com\android\server\LocationManagerService.java
 
 private void initLocationHandler() {
        String latitude = SystemProperties.get("persist.sys.adan.latitude");
        String longitude = SystemProperties.get("persist.sys.adan.longitude");
        if(latitude == null || latitude.isEmpty()){
            SystemProperties.set("persist.sys.adan.latitude","33.377631");
        }
        if(longitude == null || longitude.isEmpty()){
            SystemProperties.set("persist.sys.adan.longitude","120.139998");
        }
 
        mLocationHandlerThread = new HandlerThread("initLocationHandler");
        mLocationHandlerThread.start();
        mLocationHandler = new Handler(mLocationHandlerThread.getLooper()) {
            @Override
            public void handleMessage(@NonNull Message msg) {
                super.handleMessage(msg);
                if (msg.what == MSG_GPS) {
                    reportLocation();
                    mLocationHandler.sendEmptyMessageDelayed(0, 1000);
                }
            }
        };
        
        mLocationHandler.sendEmptyMessageDelayed(0,2000);
    }
 
/**
 *  upload gps position info
 * */
    private void reportLocation() {
        Location location = new Location(LocationManager.GPS_PROVIDER);
 
        String latitude = SystemProperties.get("persist.sys.adan.latitude");
        String longitude = SystemProperties.get("persist.sys.adan.longitude");
        location.setLongitude(Double.parseDouble(longitude));
        location.setLatitude(Double.parseDouble(latitude));
 
        location.setElapsedRealtimeNanos(System.nanoTime());
        location.makeComplete();
        LocationProvider mylocProvider = getLocationProviderLocked(LocationManager.GPS_PROVIDER);
        if (mylocProvider != null) {
            mylocProvider.onReportLocation(location);
            Log.d(TAG, "onReportLocation success " + latitude + "  " +longitude);
        } else {
            Log.d(TAG, "mylocProvider is NULL");
        }
    }

now there isn't information on launcher

car1.png

 

But I can't see the right value with my Pixel2XL mobilephone which install In-vehicle software Amap apk like below

phone.jpg

 

if someone can help me, thank you! and attach is my log

0 Kudos
1 Reply

464 Views
yhm2046
Contributor II

and the apk is :http://gofile.me/4ZJ1m/TaScxBcla password: 123123

0 Kudos