Description
Description
Description of what the issue is about
"@hmscore/react-native-hms-location": "^6.12.0-302",
xiaomi手机定位第一次定位失败
Expected behavior
What you expected to happen?
Current behavior
What actually happened?
xiaomi手机第一次调用getLastLocation方法返回null,然后看着文档先调用requestLocationUpdates,但是报错了:|9374a67e-09ab-44cf-99ad-19766020164f|Intent requestLocationUpdates api exception10806: NOT_YET_SUPPORTED
Screenshots
If applicable, add screenshots to help explain your issue
Logs
Post logs here or paste them to Ghostbin and insert the link here.
const locationRequest = {
priority: HMSLocation.FusedLocation.Native.PriorityConstants.PRIORITY_HIGH_ACCURACY,
interval: 3,
numUpdates: 10,
fastestInterval: 1000.0,
expirationTime: 200000.0,
expirationTimeDuration: 200000.0,
smallestDisplacement: 0.0,
maxWaitTime: 2000000.0,
needAddress: false,
// coordinateType: HMSLocation.Geofence.Native.GeofenceRequestConstants.COORDINATE_TYPE_GCJ_02,
};
const locationSettingsRequest = {
locationRequests: [locationRequest],
alwaysShow: false, //alwaysShow 属性指示应用程序是否需要某个位置才能继续
needBle: false, //needBle 属性指示是否需要启用 BLE 扫描
};
// HMSLocation.FusedLocation.Native.checkLocationSettings(locationSettingsRequest)
// .then(res => console.log('Location setting result:', JSON.stringify(res, null, 2)))
// .catch(ex => console.log('Error while getting location settings. ' + ex));
const reqCode = 1;
HMSLocation.FusedLocation.Native.requestLocationUpdates(reqCode, locationRequest)
.then(res => {
console.log('requestLocationUpdates', res);
const coords = res;
console.log(res);
})
.catch(err => console.log(err.message));
HMSLocation.FusedLocation.Native.getLastLocation()
.then(pos => {
console.log('Last location:', pos);
const coords = pos;
// Transform coordinates
const result = gcoord.transform(
[coords.longitude, coords.latitude],
gcoord.WGS84, // Source coordinate system
targetCoordSystem, // Target coordinate system
);
console.log('Transformed Location:', result);
const transformedLocation = {
...coords,
longitude: result[0],
latitude: result[1],
originalCoords: coords,
coordSystem: targetCoordSystem,
};
console.log('Transformed Location:', transformedLocation);
// Call success callback with transformed location
onSuccess && onSuccess(transformedLocation);
})
.catch(error => {
// Custom error handling
Alert.alert('定位失败', error.message || '无法获取当前位置', [{text: '确定'}]);
// Call error callback if provided
onError && onError(error);
console.log('Failed to get last location', error);
});
requestLocationUpdates报错
|9374a67e-09ab-44cf-99ad-19766020164f|Intent requestLocationUpdates api exception10806: NOT_YET_SUPPORTED
Environment
System:
OS: macOS 14.7.3
CPU: (10) arm64 Apple M2 Pro
Memory: 83.98 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.9.0
path: /var/folders/kb/p5p48sk13csbptrctf07nlt00000gn/T/yarn--1744852276005-0.6374809628994706/node
Yarn:
version: 1.22.22
path: ~/Documents/Daling072/node_modules/.bin/yarn
npm:
version: 9.8.1
path: /opt/homebrew/bin/npm
Watchman:
version: 2024.12.02.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.13.0
path: /Users/inkcrazy/.rvm/gems/ruby-3.0.0/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.2
- iOS 18.2
- macOS 15.2
- tvOS 18.2
- visionOS 2.2
- watchOS 11.2
Android SDK:
API Levels:
- "28"
- "29"
- "30"
- "31"
- "32"
- "33"
- "33"
- "34"
- "35"
- "35"
Build Tools:
- 28.0.3
- 29.0.2
- 29.0.3
- 30.0.2
- 30.0.3
- 31.0.0
- 33.0.0
- 33.0.1
- 33.0.2
- 34.0.0
- 34.0.0
- 35.0.0
System Images:
- android-31 | Android TV ARM 64 v8a
- android-33 | Google APIs ARM 64 v8a
- android-34 | Google APIs ARM 64 v8a
- android-UpsideDownCake | Google APIs ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9619390
Xcode:
version: 16.2/16C5032a
path: /usr/bin/xcodebuild
Languages:
Java:
version: 11.0.22
path: /Users/inkcrazy/.sdkman/candidates/java/current/bin/javac
Ruby:
version: 3.0.0
path: /Users/inkcrazy/.rvm/rubies/ruby-3.0.0/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.4
wanted: 0.72.4
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
Other
Add any other context about the problem here