I am currently trying to migrate Google Maps to Huawei map kit in my android project.
It was easy to migrate google maps to Huawei map at first. They are provided all the methods and classes that Google Maps have but now I couldn't get LocationServises class from Huawei that I used in my google maps.
In the documentation they say that Huawei Map kit has com.huawei.hms.location package and LocationServises inside. But why I cannot get it???
The links and libs that I added to gradle below: I refer the Huawei Map Kit documentation
1. maven {url 'https://developer.huawei.com/repo/'}
2. classpath 'com.huawei.agconnect:agcp:1.2.1.301'
3. maven {url 'https://developer.huawei.com/repo/'}
4. implementation 'com.huawei.hms:maps:5.1.0.300'
You can find the location services in the following artifactory
// Huawei implementation "com.huawei.hms:location:4.0.3.301"
And retrieve the location with:
FusedLocationProviderClient
Retrieve the last location with the listener
private var fusedLocationProviderClient: FusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(context)
fusedLocationProviderClient.lastLocation.addOnSuccessListener { location -> Log.d("Location", location)
}
You are advised to use Huawei Location Kit because Map Kit involves only some of location functions. :)
I am migrating the Google maps to Huawei map and in the google version there is something like public static final Api API; variable inside LocationServises class and I need this variable in Huawei too. But there no variable like this :/ do you know where to get it?
Please kindly refer to the Location Kit References.
About public enum LocationType, please refer to docs here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With