第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

在30秒內(nèi)獲得經(jīng)度和緯度

在30秒內(nèi)獲得經(jīng)度和緯度

素胚勾勒不出你 2019-11-04 14:07:11
我正在嘗試獲取用戶的位置longitude以及l(fā)atitude從GPS/network哪個(gè)位置可用,我想快速獲取它,否則,如果現(xiàn)在無法獲取新的位置坐標(biāo),則會返回以前的位置坐標(biāo)。這是我的嘗試:public class GPSTracker extends Service{    // The minimum distance to change Updates in meters    private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters    // The minimum time between updates in milliseconds    private static final long MIN_TIME_BW_UPDATES = 1000 * 60 * 1; // 1 minute    private final Context mContext;    // Declaring a Location Manager    protected LocationManager locationManager;    // flag for GPS status    boolean isGPSEnabled = false;    // flag for network status    boolean isNetworkEnabled = false;    // flag for GPS status    boolean canGetLocation = false;    Location location = null; // location    double latitude; // latitude    double longitude; // longitude    myLocationLitener locationLitener;    public GPSTracker(Context context) {        this.mContext = context;        locationLitener = new myLocationLitener();        getLocation();    }    public Location getLocation() {        try {            locationManager = (LocationManager) mContext                    .getSystemService(LOCATION_SERVICE);            // getting GPS status            isGPSEnabled = locationManager                    .isProviderEnabled(LocationManager.GPS_PROVIDER);            // getting network status            isNetworkEnabled = locationManager                    .isProviderEnabled(LocationManager.NETWORK_PROVIDER);            if (!isGPSEnabled && !isNetworkEnabled) {                // no network provider is enabled            } else {                this.canGetLocation = true;                if (isNetworkEnabled) {                    locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES,locationLitener);                    Log.d("Network", "Network Enabled");                    if (locationManager != null) {                        location = locationManager我如何使用該課程?
查看完整描述

3 回答

?
鴻蒙傳說

TA貢獻(xiàn)1865條經(jīng)驗(yàn) 獲得超7個(gè)贊

簽出FusedLocationApi。它做得很好,并且為您提供了最大限度降低電池性能的選擇。


查看完整回答
反對 回復(fù) 2019-11-04
  • 3 回答
  • 0 關(guān)注
  • 364 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號