不使用locationManager获取位置在alps x01手表上

时间:2016-05-16 06:43:11

标签: android locationmanager

我正在尝试定期获取位置,但我获得了设备上的位置,但无法获得阿尔卑斯山x01手表上的位置。

参考: - http://www.aliexpress.com/store/product/2015-new-X01-android-Smart-Watch-phone-1-54-240-240-screen-dual-core-512-4GB/1749427_32335487242.html

  LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
                if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
                    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 0, MainActivity.this);
                }
                if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
                    locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 5000, 0, MainActivity.this);
                }
 @Override
    public void onLocationChanged(Location location) {
        Log.d("location","lat = " + location.getLatitude() + " lng = " + location.getLongitude());
        Toast.makeText(MainActivity.this, "lat = " + location.getLatitude() + " lng = " + location.getLongitude(), Toast.LENGTH_SHORT).show();


    }

清单:

 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.INTERNET" />

0 个答案:

没有答案