Re: [問題] 不同device對bug的反應不同?

作者: asilzheng (asil)   2014-10-10 22:41:39
※ 引述《htury (冰點)》之銘言:
: Location netlocation =
: locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
: Location gpslocation =
: locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
: if (gpslocation != null && gpslocation.getTime() > netlocation.getTime()) {
: location = gpslocation;
: } else {
: location = netlocation;
: }
用 getLastKnownLocation 是抓取上一次系統取得的位置
如果要讓 LocationManager 重新取得目前位置的話
請用 requestLocationUpdates

Links booklink

Contact Us: admin [ a t ] ucptt.com