您好,登錄后才能下訂單哦!
?GPS NMEA-0183標準數(shù)據(jù)介紹
https://www.cnblogs.com/rechen/p/5135409.html? (可以準確判斷是否在定位)
源碼分析:
? ??https://www.ibm.com/developerworks/cn/opensource/os-cn-android-location/
????
?1.?源碼所在的目錄
2.?
http://ju.outofmemory.cn/entry/111182
3.?
4.?LocationManager生成實例的位置
5.?frameworks/base/core/java/android/app/ContextImpl.java
registerService(LOCATION_SERVICE,?new?ServiceFetcher()?{
????public?Object?createService(ContextImpl?ctx)?{
????????IBinder?b?=?ServiceManager.getService(LOCATION_SERVICE);
????????return?new?LocationManager(ctx,?ILocationManager.Stub.asInterface(b));
????}
});
???????而ServiceManager里的的"LOCATION_SERVICE"又是從com.android.server.SystemServer這個類添加進去的
if?(!disableLocation)?{
????traceBeginAndSlog("StartLocationManagerService");
????try?{
????????location?=?new?LocationManagerService(context);
????????ServiceManager.addService(Context.LOCATION_SERVICE,?location);
????}?catch?(Throwable?e)?{
????????reportWtf("starting?Location?Manager",?e);
????}
????Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
????traceBeginAndSlog("StartCountryDetectorService");
????try?{
????????countryDetector?=?new?CountryDetectorService(context);
????????ServiceManager.addService(Context.COUNTRY_DETECTOR,?countryDetector);
????}?catch?(Throwable?e)?{
????????reportWtf("starting?Country?Detector",?e);
????}
????Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
}
? ?LocationManagerService的reportLocation方法觸發(fā)了應用上層onLocationFound的回調(diào)
@Override
public?void?reportLocation(Location?location,?boolean?passive)?{
????checkCallerIsProvider();
????if?(!location.isComplete())?{
????????Log.w(TAG,?"Dropping?incomplete?location:?"?+?location);
????????return;
????}
????mLocationHandler.removeMessages(MSG_LOCATION_CHANGED,?location);
????Message?m?=?Message.obtain(mLocationHandler,?MSG_LOCATION_CHANGED,?location);
????m.arg1?=?(passive???1?:?0);
????mLocationHandler.sendMessageAtFrontOfQueue(m);
}
????順藤摸瓜,最終找到
public?boolean?callLocationChangedLocked(Location?location)?{
????if?(mListener?!=?null)?{
????????try?{
????????????synchronized?(this)?{
????????????????//?synchronize?to?ensure?incrementPendingBroadcastsLocked()
????????????????//?is?called?before?decrementPendingBroadcasts()
????????????????mListener.onLocationChanged(new?Location(location));
????????????????//?call?this?after?broadcasting?so?we?do?not?increment
????????????????//?if?we?throw?an?exeption.
????????????????incrementPendingBroadcastsLocked();
????????????}
????????}?catch?(RemoteException?e)?{
????????????return?false;
????????}
????}?else?{
????那么LocationManagerService的reportLocation方法又是怎么被觸發(fā)的呢?
? ??
?
????
1.?ILocationManager.aidl
2.?frameworks/base/location/java/android/location/ILocationManager.aidl
3.?
4.?
? GPS定位漂移產(chǎn)生的原因:https://baike.1688.com/doc/view-d41865087.html
? GPS的NEMA協(xié)議解析:https://blog.csdn.net/adazone/article/details/45152291
? 點到直線的距離計算公式:https://blog.csdn.net/bagboy_taobao_com/article/details/6291462
? 經(jīng)緯度求坐標方位角:?https://blog.csdn.net/u010175314/article/details/76093934
? NMEA編碼:https://baike.baidu.com/item/NMEA/9812575?fr=aladdin
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。