Closed ohszehong closed 2 years ago
Which version of location plugin you used?
Which version of location plugin you used?
6.4.0-300
Which version of location plugin you used?
react-native-hms-location 6.4.0-300
As you shown, you are using the latest plugin. I tried the same version, and geocoder is working in sample project with latitude 41.9229705, Longtitude 12.4308223.
Can you share the error log?
my code as below:
try {
const result = await HMSLocation.FusedLocation.Native.getLastLocation();
const request = {
latitude: result.latitude,
longitude: result.longitude,
maxResults: 3,
};
const locale = {
language: 'en',
};
const address = await HMSLocation.Geocoder.Native.getFromLocation(
request,
locale,
);
setLocationText(address);
} catch (err) {
setLocationText(err);
}
and one thing is that I'm testing this on huawei cloud debugging as I don't have any huawei device, will that somehow affects the result? and for the same reason, I'm unable to provide any meaningful error log except for the error message returned from the api
As you shown, you are using the latest plugin. I tried the same version, and geocoder is working in sample project with latitude 41.9229705, Longtitude 12.4308223.
Can you share the error log?
Another thing is that when I tried to use getLastLocation() on my non-huawei actual device with hms mobile service installed, it does returns the latitude and longitude, but on cloud debugging it said that the result return is null (error 810). Though, the getFromLocation() on my device returns error code of 10806 indicating that the api is currently not available.
In some cloud debug device, the location function cannot be used. Location kit is working in non-huawei device. You can test your demo in that device.
In some cloud debug device, the location function cannot be used. Location kit is working in non-huawei device. You can test your demo in that device.
Getting the location is working fine on my non-huawei device, but as for the geocoder I got the error code of 10806 not supported yet
You are right, only Huawei mobile supported. https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/introduction-0000001050706106
It seems you have to use Huawei Mobile. Or you can try to hard code latitude and longitude and try the geocoding function.
Had to use an actual huawei device
Description I'm trying to use the hms location kit and followed the sample guide accordingly, the gps detection is working fine but there's some issue with the geocoder, when I tried to use the geocoder it gives me the error as stated in the title.
Expected behavior Passing an object with { longitude, latitude, maxResult} to geocoder and it should return the location name
Current behavior It shows error with message of "need to update kit" instead.
Environment